Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to turn non-parallel junit parameterized tests into parallel run

I write a parameterized junit test.

Is there any built-in way to make it run in parallel? any @annoation for example?

If not, and my only way is to write this manually -

how would you manage a thread pool in junit, java?

like image 635
Elad Benda2 Avatar asked Mar 28 '15 00:03

Elad Benda2


People also ask

Do parameterized tests run in parallel?

With the specification of the CONCURRENT execution mode annotations, the parameterized tests defined in each of the inner classes will be run in parallel thus achieving the desired goal.

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.

Does JUnit 4 run tests in parallel?

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


1 Answers

The library JUnit Toolbox provides a ParallelParameterized runner. Replace

@RunWith(Parameterized.class)
public class YourTest {

with

@RunWith(ParallelParameterized.class)
public class YourTest {
like image 68
Stefan Birkner Avatar answered Oct 14 '22 06:10

Stefan Birkner