I have a bunch of tests that are organized in JUnit test suites. These tests are greatly utilizing selenium to test a web application. So, naturaly for selenium, the runtime of these tests is quite long. Since the test classes in the suites can not run parallel due some overlaps in the test database, i would like to run the suites parallel.
The JUnit ParallelComputer can only execute tests on class or method level in parallel, are there any standard ways for JUnit to do that with suites?
If i just pass suite classes to the junit runner and configure the computer to parallelize on class level, it picks the test classes itself, not the suites.
br Frank
Here is some code that worked for me. I did not write this. If you use
@RunWith(ConcurrentSuite.class)
instead of@RunWith(Suite.class)
it should work. There is an annotation that is also needed which is found below.And the annotation is as follows.
Since Suite is used to annotate a Class, so run the Suite-annotated class in
JUnitCore.runClasses(ParallelComputer.classes(), cls)
way.cls
are Suite-annotated classes.