java - Surefire-plugin 执行测试用例的顺序是什么?

标签 java maven maven-surefire-plugin surefire

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/

相关文章:

java - 来自多个属性文件的 Spring i18n 本地化

java - 失败 - 上下文路径/j2eeapplication 中的应用程序无法启动

java - TestNG - 如何在 testng 自定义可通过电子邮件发送的报告中打印运行时 testng 参数?

java - 为什么 JUnit 会忽略基类上的 @Category 注解?

maven - 如何在NetBeans IDE中将Maven的远程存储库URL更改(从http更改为https)?

java - Spring data rest findBy securityCheck 用于嵌套实体

java - 如何将查询参数添加到 GetMethod(使用 Java commons-httpclient)?

java - 在 Android 中无法 http 连接

java - 在外部类中创建 JTabbedPane

android - 将 maven 添加到 android 项目