I don't know if this is by design or not, just noticed that I set up testNG like this:
<suite name="Suite" parallel="classes" thread-count="4">
<test name="Test">
<classes>
<class name="Test2"/>
<class name="Test1"/>
<class name="Test3"/>
<class name="Test4"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
And then inside my test,
public class BaseTest {
@AfterTest
public void afterAll() {
System.out.println("tear down webdriver here ");
this.webDriver.quit();
}
}
The Test1 to Test 4 are all extending this base test.
But I noticed that after a refresh start of selenium hub, with two nodes, first few runs are all good, but when looking at console, the available resource is becoming less and less, after a few times run, there is no available resource anymore and all the test are just waiting. Actually, everytime when the webdriver.quit() is called, it only close ONE session, and all other sessions are still open.
This has made Selenium Grid solution not that elegant at all, we have to borrow a lot extra solutions, such as restarting selenium grid whenever we start new testing job etc.
So, why the driver.quit() can not close all the grid sessions, instead it only close ONE session? the driver is already singlton, and it is shared among all the testcases already.
Hope to hear your advice on this.
Thanks