Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven parallel test output

Tags:

java

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
....

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.

like image 459
moon.mid Avatar asked Feb 25 '14 06:02

moon.mid


People also ask

Can you run JUnit tests in parallel?

Once the parallel execution property is set (or enabled), the JUnit Jupiter engine will run the tests in parallel as per the configurations provided with the synchronization mechanisms.

What is forkCount in POM XML?

The parameter forkCount defines the maximum number of JVM processes that maven-surefire-plugin will spawn concurrently to execute the tests. It supports the same syntax as -T in maven-core: if you terminate the value with a 'C', that value will be multiplied with the number of available CPU cores in your system.

What is Argline in Maven?

Java command line when Run/Debug configuration is launched, the Surefire argline defined in maven pom. xml are automatically appended. This causes issues when the properties need to be overridden by specifying a system property in the VM options of the Run/Debug configuration.


1 Answers

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 plugin responsible for running the tests generates reports per test.

There is also surefire report plugin

Hope this helps

like image 128
Mark Bramnik Avatar answered Nov 09 '22 04:11

Mark Bramnik