1

We have API tests written with Rest Assured and JUnit 5 and are trying to run the tests in parallel since there are no dependencies between the tests. We've tried the experimental parallel execution of JUnit 5 by setting:

junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=same_thread
junit.jupiter.execution.parallel.mode.classes.default=concurrent

..but have seen that usually when tests fail, their output isn't included in the test report.

Is this a known issue? Are there any workarounds?

mowwwalker
  • 16,634
  • 25
  • 104
  • 157

1 Answers1

0

It turns out that the issue was probably actually with gradle's processing of the test output. In our case we resolved this by using parallelization within gradle rather than within Junit by adding this to our gradle test task:

    forkEvery 1
    maxParallelForks 20

I'm not sure what the best value for maxParallelForks is. 20 is just what we're starting with and will adjust if needed. The Gradle docs recommend setting it based on the number of processors. (see also this SO question)

maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1

Also, the Gradle docs explicitly warn against setting forkEvery to 1 and claim that it's "very expensive". In our case it worked fine but that could be due to having only a minimal setup within Gradle for this project.

Some related links to check out:

mowwwalker
  • 16,634
  • 25
  • 104
  • 157