<小时/>based on Does Maven Surefire execute test cases sequentially by default?, I know that the surefire execute test cases sequentially, in other words, One by One.
我想知道哪些测试用例先执行,后执行哪些,通过surefire的输出信息,我发现顺序可能是随机的,例如:
- 测试
boyTest.java
子目录
- girlTest.java
- parentTest.java test目录下有3个测试用例:测试用例执行顺序为girlTest.java,parentTest.java,boyTest.java
and So I want to make sure that whether the order that testCase executed is
random
最佳答案
要验证使用的 orderfire 是否是您期望的顺序,请在启用调试的情况下运行构建(-x
标志)。例如。就我而言,我看到以下内容:
mvn clean install -X | grep runOrder
...
<runOrder default-value="filesystem">hourly</runOrder>
[DEBUG] (s) runOrder = hourly
默认情况下,顺序不是随机的,而是通过文件系统返回测试列表的方式来定义(用万无一失的术语来说是文件系统
)。
还有其他可用的顺序,您可以通过 surefire.runOrder
属性进行选择(其中之一是random
)。
有关更多信息,请参阅 Surefire plugin runOrder
关于java - Surefire-plugin 执行测试用例的顺序是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40070205/