@BeforeClass not executed in parallel when parallel="instances"
See original GitHub issueI personally came across the source of my problem when I found this stack overflow thread which helped me make sense of some strange behavior I’ve been encountering with a Factory + DataProvider + Parallel Instances
It doesn’t look like a bug was ever filed, but I am getting burned with my selenium tests queueing against the grid, and waiting for a browser in the @BeforeClass
annotation which sets up my test in a parent class. The child class has a @Factory
to create all the instances up front, and the @Test
method to actually carry out the test. The problem is that once a browser hits the grid queue, no other tests will start up, even though there are plenty of instances available (we test against various browsers, so having 1 browser flavor queue up doesn’t mean that the grid is completely busy).
The example posted in the stack overflow thread is:
@BeforeClass
public void beforeClass() throws InterruptedException{
System.out.println("In Before Class ::: " + Thread.currentThread().getId());
Thread.sleep(2000);
}
@Test
public void test(){
System.out.println("In Test ::: " + Thread.currentThread().getId());
}
@AfterClass
public void afterClass(){
System.out.println("In After Class ::: " + Thread.currentThread().getId());
}
I am running 6.9.9.
Issue Analytics
- State:
- Created 7 years ago
- Comments:18
The fix should be available either in the next beta version or the released version of TestNG.
Has anyone found a workaround?