views:

3990

answers:

7

I'm using junit 4.4 and maven and I have a large number of long-running integration tests.

When it comes to parallellizing test suites there are a few solutions that allow me to run each test method in a single test-class in parallel. But all of these require that I change the tests in one way or another.

I really think it would be a much cleaner solution to run X different test classes in X threads in parallel. I have hundreds of tests so I don't really care about threading individual test-classes.

Is there any way to do this ?

+1  A: 

TestNG can do that (this was my first reflex - then I saw you're already having a lot of testcases).

For JUnit, look at parallel-junit.

philippe
Unfortunately this is not the answer to the question I am asking. parallel-junit only runs within a single test class. TestNG also only runs within a single class, and my tests are not TestNG tests.
krosenvold
A: 

You can change your test to be TestNg test in a minute (you just need to change imports), TestNG is the best in parallel testing.

+1  A: 

You could try Gridgain that lets you run distribute your tests across a compute grid.

Jan Kronquist
+2  A: 

From junit 4.7 it's now possible to run tests in parallel without using TestNG. Actually it has been possible since 4.6, but there are a number of fixes being made in 4.7 that will make it a viable option. You may also run parallel tests with spring, which you can read about here

krosenvold
+2  A: 

tempus-fugit offers something similar, check the docs for details. It relies on JUnit 4.7 and you just mark your test to @RunWith(ConcurrentTestRunner).

Cheers

Toby
Nice project you have there ;) I'll check it out
krosenvold
A: 

Actually, after reading all these answers I decided to write my own solution. It seems much easier for me.

http://solutionsdaily.blogspot.com/2010/06/making-junit-tests-run-parallely.html

solutionsdaily
A: 

This solution is very convenient:

http://aminoprj.blogspot.com/2008/11/extending-junit-for-testing-parallel.html

James