我是Maven和Jenkins的新手,无法弄清楚如何:
在Jenkins的同一版本中使用testng-failed.xml
通过Maven(pom.xml
)重新运行失败的测试用例。
使用我的自动化代码,我想运行两个不同的套件,即smoke.xml
&中出现的烟雾和回归。 regression.xml
。
我尝试将两个xml文件放在<suiteXmlFiles>
节点下,但这给了我错误。
如果我需要为运行烟雾和回归套件创建单独的Jenkins作业,请告诉我。提前谢谢。
答案 0 :(得分:0)
In Pom.xml add two profiles one for regression and other for smoke.Create seperate Jobs in Jenkins for Regression and smoke and configure with corresponding profiles.
Sample Pom.xml profile for regression, do the same for smoke:
<profile>
<id>REGRESSION</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${testng.memory.opts}</argLine>
<includes>
<include>${test.include}</include>
</includes>
<excludes>
<exclude>${test.exclude}</exclude>
</excludes>
<suiteXmlFiles>
<suiteXmlFile>path/Regression-test.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
</systemPropertyVariables>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>${testng.listeners}</value>
</property>
</properties>
<!-- <workingDirectory>${project.build.testOutputDirectory}/</workingDirectory> -->
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire-report-plugin.version}</version>
<configuration>
<outputDirectory>${project.build.directory}/${surefire.reports.dir}</outputDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</profile>