Running a JUnit4 Test Suite in Maven using maven-failsafe-plugin

旧时模样 提交于 2019-12-03 07:35:54

Failsafe plugin supports runOrder (click) parameter since version 2.7 (quite recent). There aren't many options, you cannot specify the order explicitly, but you can set it to "alphabetical" and rename your test classes to reflect the run order.

May I also say on the occasion that the fact that test depend on each other is (test) code smell; it's not good, as it is a short path to developing an unmaintainable set of tests and abandoning it finally when its complexity skyrockets above human comprehension. Plus it may fail to expose bugs, as it is a result of one chosen execution path.

BTW, I prefer to include tests like this, with a double asterisk:

<includes>
     <include>**/IntegrationSuite.java</include>
</includes>

maven-surefire-plugin can also be used as below code:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<includes>
<include>**/IntegrationSuite.java</include>
</includes>
</configuration>
</plugin>     
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!