我已经配置了Jenkins/Maven项目,它从POM文件配置中读取TestNG测试,其中包含要运行的测试指令。
如果我要向XML文件(例如Test1和Test2)添加更多的测试,它们将依赖于同一个POM文件,并且当我在Jenkins中创建一个作业时,这两个测试都将在一个Jenkins作业中运行。
我的问题是:
如何配置Maven或Jenkins使能够在Jenkins中创建两个单独的作业(JobTest1和JobTest2),但使用(单个POM文件)
发布于 2017-04-24 16:16:05
我的建议是-创建不同的马文(氏)并为特定Jenkin的工作执行它。
例如,您有两个不同的测试类,您可以在pom文件中为每个类创建一个特定的配置文件:
<profiles>
<profile>
<id>test1</id>
<properties>
<suite.pattern>**/TestOne.java</suite.pattern>
</properties>
</profile>
<profile>
<id>test2</id>
<properties>
<suite.pattern>**/TestTwo.java</suite.pattern>
</properties>
</profile>现在您可以单独运行它们:
mvn clean test -P test1或
mvn clean test -P test2因此,您可以配置两个Jenkins作业。
发布于 2017-04-27 19:05:04
我找到了另一个解决办法。在中,需要编写如下命令:-Dtest=FirefoxTest2.java clean test
不需要在POM文件中添加任何有关java类的附加信息。
https://stackoverflow.com/questions/43592895
复制相似问题