How can I run tests in parallel, but get a neatly ordered test result?

I use sbt and JUnit to run tests for a large Scala project. I am deploying several test JVMs and determining how tests should be grouped in the JVM using testGrouping in Test .

Tests run in parallel, but their output alternates, making reading difficult. I set logBuffered in Test := true , but that seems to do nothing.

Here is a snippet from my settings :

 parallelExecution in Test := true, testForkedParallel in Test := false, concurrentRestrictions in Global := Seq(Tags.limit(Tags.ForkedTestGroup, 8)), testGrouping in Test := (definedTests in Test, javaOptions in Test) map groupBySuite, testGrouping in Test := { val original: Seq[Tests.Group] = (testGrouping in Test).value original.map { group => val forkOptions = ForkOptions( bootJars = Nil, javaHome = javaHome.value, connectInput = connectInput.value, outputStrategy = outputStrategy.value, runJVMOptions = (javaOptions in Test).value, workingDirectory = Some(baseDirectory.value), envVars = envVars.value ) group.copy(runPolicy = Tests.SubProcess(forkOptions)) } }, logBuffered in Test := true, 

How can I keep my tests parallel, but somehow buffered and displayed in order to be readable? Could there be some kind of setting that I need to pass to outputStrategy in the JVM forked parameters?

There is a similar question here , but I want my tests to run in parallel.

+5
source share
1 answer

See http://www.scala-sbt.org/1.x/docs/Parallel-Execution.html

parallelExecution in Test controls the display of tests for individual tasks. To limit the number of simultaneously running tests in all projects, use:

 concurrentRestrictions in Global += Tags.limit(Tags.Test, 1) 
-1
source

Source: https://habr.com/ru/post/1208926/


All Articles