Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running JUnit Tests in Parallel in IntelliJ IDEA

I have a large suite of tests that takes about half an hour to run and would love to be able to the test classes in parallel.

Is there a way to do that with IntelliJ IDEA 9?

like image 838
Omer van Kloeten Avatar asked Aug 24 '10 11:08

Omer van Kloeten


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.

How do I run parallel in IntelliJ?

Allow parallel runSelect Run | Edit Configurations from the main menu or Edit Configurations from the run/debug configuration selector on the toolbar. Choose your configuration from the list. Select the Allow parallel run checkbox and click OK.

Does JUnit 4 run tests in parallel?

A plugin that allows you to run JUnit4 tests in parallel (using multiple CPU cores/threads).


2 Answers

IDEA will understand parallel JUnit tests only since version 10.

There is a tracker issue which you can vote for and watch for progress: http://youtrack.jetbrains.net/issue/IDEA-47103

We plan to add it in IDEA 10, but the priority would depend on the number of votes.

like image 59
CrazyCoder Avatar answered Oct 19 '22 14:10

CrazyCoder


Answering late for posterity.

You can make JUnit tests run in parallel (or serial) to any level of granularity in IntelliJ by changing the Fork mode in the test's run configuration.

Be careful not to confuse this with the Allow parallel run option, which lets you start the test execution multiple times within your IDE.

To specify the parallelization of a JUnit test (or group of tests) in IntelliJ, open the Run Configuration for that test and change the Fork mode setting or the Allow parallel run setting. This image depicts IntelliJ IDEA 2018.3.4

like image 9
JJ Brown Avatar answered Oct 19 '22 13:10

JJ Brown