Junit4 provides parallel feature using ParallelComputer:
public class ParallelComputerTest {
@Test
public void test() {
Class[] cls={ParallelTest1.class,ParallelTest2.class };
//Parallel among classes
JUnitCore.runClasses(ParallelComputer.classes(), cls);
//Parallel among methods in a class
JUnitCore.runClasses(ParallelComputer.methods(), cls);
//Parallel all methods in all classes
JUnitCore.runClasses(new ParallelComputer(true, true), cls);
}
public static class ParallelTest1 {
@Test public void a(){}
@Test public void b(){}
}
public static class ParallelTest2 {
@Test public void a(){}
@Test public void b(){}
}
}