Maven的。在另一个插件执行时执行一个插件

时间:2016-07-18 10:18:04

标签: java maven maven-surefire-plugin serenity-bdd

我有一个问题。 我想在一个插件(surefire-plugin)执行测试,而在执行surefire-plugin时,我需要通过serenity-plugin创建报告 所以我的pom没有按照我想要的方式执行,看起来像:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.portal</groupId>
    <artifactId>portalAT</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Portal autotests ui</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencies>

        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber</artifactId>
            <version>1.1.8</version>
        </dependency>
       <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>1.1.37-rc.6</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.18</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                   </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>1.1.36</version>
                <dependencies>
                    <dependency>
                        <groupId>net.serenity-bdd</groupId>
                        <artifactId>serenity-core</artifactId>
                        <version>1.1.36</version>
                    </dependency>
                </dependencies>
                 <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.temyers</groupId>
                <artifactId>cucumber-jvm-parallel-plugin</artifactId>
                <version>1.3.0</version>
                <executions>
                    <execution>
                        <id>generateRunners</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>generateRunners</goal>
                        </goals>
                        <configuration>
                            <glue>com.portal.glue.cucumber</glue>
                            <outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>
                            <featuresDirectory>src/test/resources/features/</featuresDirectory>
                            <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
                            <format>html</format>
                            <strict>true</strict>
                            <monochrome>true</monochrome>
                            <tags>"~@ignore"</tags>
                            <filterFeaturesByTags>true</filterFeaturesByTags>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <executions>
                    <execution>
                        <id>acceptance-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8 -Dwebdriver.remote.url=http://11.111.11.11:4444/wd/hub -Dwebdriver.driver=chrome</argLine>
                    <includes>
                        <include>**/*IT.class</include>
                    </includes>
                    <forkCount>2</forkCount>
                    <reuseForks>false</reuseForks>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

我尝试朗姆酒:mvn test serenity:aggregatemvn surefire:test serenity:aggregate

我需要把这两个插件集成在一起,因为我的预期由serenity插件生成的报告是空的。

0 个答案:

没有答案
相关问题