指定要进行的 Junit 测试 运行
Specify which Junit test to run
我正在使用 Selenium Junit Maven 和 Jenkins,指定对 运行 进行哪些测试的最佳方法是什么?
我尝试了 Categories 但发现它太复杂了。有没有一种简单的方法来指定 methods/class 到 运行 的测试?
虽然我认为类别是可行的方法,但您也可以在 surefire 插件配置中 include/exclude 测试 类。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>Sample.java</include>
</includes>
</configuration>
</plugin>
如果要执行single test method,可以指定test
属性
mvn -Dtest=TestCircle#mytest test
您也可以在 pom.xml 中设置 test
属性 并在不同的配置文件中设置不同的设置,但最后,类别优于那个并且是一个很好的测试套件设计实践。
我正在使用 Selenium Junit Maven 和 Jenkins,指定对 运行 进行哪些测试的最佳方法是什么? 我尝试了 Categories 但发现它太复杂了。有没有一种简单的方法来指定 methods/class 到 运行 的测试?
虽然我认为类别是可行的方法,但您也可以在 surefire 插件配置中 include/exclude 测试 类。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>Sample.java</include>
</includes>
</configuration>
</plugin>
如果要执行single test method,可以指定test
属性
mvn -Dtest=TestCircle#mytest test
您也可以在 pom.xml 中设置 test
属性 并在不同的配置文件中设置不同的设置,但最后,类别优于那个并且是一个很好的测试套件设计实践。