Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to distribute junit tests so they all get done faster?

Our JUnits take a total of 6 hours to run. Is there an easy way to run 1/n of them on n different machines?

like image 971
Josh Avatar asked Jun 01 '10 21:06

Josh


People also ask

Do JUnit tests run concurrently?

Once parallel test execution property is enabled, the JUnit Jupiter engine will execute tests in parallel according to the provided configuration with declared synchronization mechanisms.

How do I run parallel execution in JUnit?

By enabling parallel execution, the JUnit engine starts using the ForkJoin thread pool. Next, we need to add a configuration to utilize this thread pool. We need to choose a parallelization strategy. JUnit provides two implementations (dynamic and fixed) and a custom option to create our implementation.


1 Answers

GridGain (a free cloud implementation) is able to distribute JUnit tests runs across a cluster of nodes. See Distributed JUnit Overview.

Just in case, this is not exactly what you're asking for but TestNG can run tests in parallel (thi would already make your build faster). See Advanced parallel testing with TestNG and data providers.

See also

  • Running JUnit in Parallel
  • Parallelizing JUnit test runs
like image 161
Pascal Thivent Avatar answered Sep 22 '22 05:09

Pascal Thivent