如何使用Maven故障安全插件执行预集成步骤

时间:2018-05-06 20:20:29

标签: maven jenkins testng maven-failsafe-plugin

我需要在回归套件之前执行testNG(config)测试。此测试执行一些与配置相关的任务并创建用户。有人可以解释下面的POM。我仍然试图了解如何在POM.xml中定义步骤。我的测试名称是CreateUsers.xml。我应该在以下POM.XML中定义它。我正在使用jenkins来运行这些测试。请指教。感谢

id,goal和include标签是什么意思?

<build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.21.0</version>
                <executions>

                    <execution>
                        <id>pre-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/PreTest.class</include>
                            </includes>
                        </configuration>
                    </execution>

                    <execution>
                        <id>int-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/IntTest.class</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

我添加了我的必备testNG,如下所示。如果这是正确的,请告知?感谢

<groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <version>2.21.0</version>
  <type>maven-plugin</type>
 
<executions>

                    <execution>
                        <id>pre-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>CreateUsers.xml</include>
                            </includes>
                        </configuration>
                    </execution>
 
</executions>  

0 个答案:

没有答案