I am trying to implement parallel running TestNG tests with selenium grid, where grid gets dynamic nodes attached. Based on the number of nodes in the grid I want to increase or decrease the number of threads in the TestNG.
Is it possible if so How?
I have tried following cases.
public class SuiteAlterer implements IAlterSuiteListener {
@Override
public void alter(List<XmlSuite> suites) {
// TODO Auto-generated method stub
System.err.println("**Alter is invoked**");
int count = NodeInfoFromGrid.getNumberOfNodes();//returns number of grid nodes that are free.
if (count <= 0) {
return;
}
for (XmlSuite suite : suites) {
suite.setThreadCount(count);
}
}
}
In the Listener OnStart(ITestContext context)
added following statement:
context.getSuite().getXmlSuite().setThreadCount(NodeInfoFromGrid.getNumberOfNodes());
But TestNG is not honoring above statement.