显示在没有-X选项的测试类中运行的所有测试

时间:2014-02-21 23:03:14

标签: maven junit surefire

有没有办法配置mvn命令来显示测试摘要(在Results:部分)中运行哪些测试(测试类中的测试方法)而不使用过于冗长的 - X选项?

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.myproject.MyTestClass
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.033 sec <<< FAILURE!

Results :
  #I would like to show the passed test here
Failed tests: 
  testTwo(com.myproject.MyTestClass)

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0

1 个答案:

答案 0 :(得分:1)

不,不容易。运行测试的maven-surefire-plugin只能生成您已经看到的失败测试的摘要和列表(DefaultReporterFactory#runCompleted)。

如果您真的想将其添加到构建中,则可以在运行测试后处理target/surefire-reports中留下的XML文件,可能使用Groovy脚本或XSLT to standard output之类的内容。

相关问题