测试完成后自动生成诱惑报告

Cat*_*hal 2 testng selenium maven allure

我试图找出在TestNG套件完成后如何自动构建诱惑报告.我知道可以通过mvn site在测试后手动运行来创建报告,但如果可以自动生成报告,那将会很棒.下面是我的pom.xml中的allure配置

                <properties>
                  <testng.congig>${selenium.suite}</testng.congig>
                  <aspectj.version>1.7.4</aspectj.version>
                  <allure.version>1.4.3</allure.version>
                </properties>

              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.14</version>
                <configuration>
                    <testFailureIgnore>false</testFailureIgnore>
                    <argLine>
                        -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                    </argLine>
                    <suiteXmlFiles>
                        <suiteXmlFile>target\test-classes\${testng.congig}</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <dependency>
              <groupId>ru.yandex.qatools.allure</groupId>
              <artifactId>allure-testng-adaptor</artifactId>
              <version>${allure.version}</version>
           </dependency>

           <reporting>
             <excludeDefaults>false</excludeDefaults>
             <plugins>
              <plugin>
                 <groupId>ru.yandex.qatools.allure</groupId>
                 <artifactId>allure-maven-plugin</artifactId>
                 <version>{latest.version}</version>
               </plugin>
             </plugins>
           </reporting>
Run Code Online (Sandbox Code Playgroud)

wem*_*emu 6

测试执行和站点生成在不同的生命周期中运行.

默认生命周期与站点生命周期不同,请参阅https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

你可以做的只是链接命令:例如,mvn install site或者mvn deploy site-deploy如果你打算在某个地方提供网站.这将运行测试,然后执行站点生成.

maven目标与该生命周期中的阶段有关.mvn package将执行绑定到其中一个阶段的所有插件,直到package阶段.由于站点生成有自己的生命周期,因此我不会将插件执行绑定到默认生命周期的其中一个阶段.报告插件通常依赖于完成的构建.