Maven并行测试输出

Maven并行测试输出

本文介绍了Maven并行测试输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我设置我的Maven构建以并行运行我的集成测试时,我看到:

When I set my Maven build to run my integration tests in parallel, I see:

01:31:47 -------------------------------------------------------
01:31:47  T E S T S
01:31:47 -------------------------------------------------------
01:31:48 Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=20, useUnlimitedThreads=false

但是我没有看到任何测试的进度。最终,它们全部完成,输出一下子被抛弃。

But then I don't see the progress of any of my tests. Eventually, they all finish and the output gets dumped out all at once.

01:41:42 Running com.my.test.TestClass
01:41:42 Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 69.706 sec
....

该测试类在一分钟后完成,但在10分钟后所有测试完成后才输出。

That test class finished after a minute yet it wasn't output until all the tests finished 10 minutes later.

如何在完成输出后获得每个类的结果?否则很难理解构建的进度。

How can I get the results of each class as it finishes to get output? It's hard to understand the progress of the build otherwise.

推荐答案

希望,我的问题是对的。我认为这是因为并行运行的测试不能真正使用相同的控制台来通知自己的进度,而不是技术上,但从概念上讲它并没有真正意义。
由于maven同时处理模块,因此同时运行的2个测试将共享控制台。你只是在输出中得到垃圾。

Hope, I've got your question right. I think that's because tests that are being running in parallel can't really use the same console to notify their own progress, not technically, but conceptually it doesn't really make sense.Since maven processes the modules concurrently it possible that 2 tests running simultaneously will "share" the console. You'll just get the garbage in an output.

所以相反,我想你应该只看一下控制台的整体结果,然后去报告每个模块。

So instead, I guess you should take a look only on the overall results in the console and go for reports per module.

负责运行测试的Surefire插件会为每次测试生成报告。

Surefire plugin responsible for running the tests generates reports per test.

还有

希望这有帮助

这篇关于Maven并行测试输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 23:33