如何列出 `mvn test` 将运行的测试没有实际运行?

问题描述

如何列出 mvn test 将运行哪些测试(没有实际运行)?

https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

认情况下,Surefire 插件自动包含所有具有以下通配符模式的测试类:

- `"**/Test*.java"` - includes all of its subdirectories and all Java filenames that start with "Test".
- `"**/*Test.java"` - includes all of its subdirectories and all Java filenames that end with "Test".
- `"**/*Tests.java"` - includes all of its subdirectories and all Java filenames that end with "Tests".
- `"**/*TestCase.java"` - includes all of its subdirectories and all Java filenames that end with "TestCase".

但是当有许多长时间运行的测试或 JUnit4 和 junit5 测试的混合时, 检查每个测试可能需要很长时间 (特别是对于之前跳过单元测试的情况)

是否有可能只是空转?看看要运行哪些测试, 但实际上并没有运行它们。

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running JUnitAndMockitoWorksTest
Running JUnit4AndMockitoWorksTest
Running junit5AndMockitoWorksTest

更新

旧的 Maven: Surefire --dry-run? 指向 https://github.com/janinko/maven-surefire/tree/feature/dryrun 但是那个fork已经9年没有更新了,当然不会支持JUnit 5等新东西了。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)