I have a JUnit suite containing around 10-15 test cases. When i ran them, they execute one by one. Some of my test cases contain are verifying scheduled jobs, so they invoke the scheduled job and then wait for their completion. For that, i put Thread.sleep() in the code and after that i put assertion. e.g.,
public class TestCase1 extends JUnit {
@Test
public void testCase1(){
//Do something
//invoke scheduler task
Thread.sleep(300 * 1000);
//Do Assertion
}
Now, i want to avoid this Thread.sleep() because it is contributing to the time of Test Suite execution. One approach came to my mind is to assertion code to be execute in parallel with other test cases. But, i am not sure if it will work or not.
Please help