Running your tests in parallel is a powerful way to speed up your tests.
Good automated tests should be independent, isolated and reproducible, making them ideal candidates for being run concurrently
But in real world scenarios of web testing this hardly happens and when it does we must make use of JUnit parallel testing capability to speed up the testing
Example
@Test
public void Test1() {
System.out.println("In Test 1");
}
@Test
public void Test2() {
System.out.println("In Test 2");
}
@Test
public void Test3() {
System.out.println("In Test 3");
}
Runner class
@RunWith(ParallelSuite.class)
@SuiteClasses({Test1.class, Test2.class, Test3.class})
public class ABCSuite {}
Dependencies
Good automated tests should be independent, isolated and reproducible, making them ideal candidates for being run concurrently
But in real world scenarios of web testing this hardly happens and when it does we must make use of JUnit parallel testing capability to speed up the testing
Example
@Test
public void Test1() {
System.out.println("In Test 1");
}
@Test
public void Test2() {
System.out.println("In Test 2");
}
@Test
public void Test3() {
System.out.println("In Test 3");
}
Runner class
@RunWith(ParallelSuite.class)
@SuiteClasses({Test1.class, Test2.class, Test3.class})
public class ABCSuite {}
Dependencies
<dependency> <groupId>com.googlecode.junit-toolbox</groupId> <artifactId>junit-toolbox</artifactId> <version>2.0</version> </dependency>
No comments:
Post a Comment