Hi,
I am having understanding gap for parallel=instances functionality. Rest way of running tests in parallel is clear and i have implemented well.
As per documentation : parallel="instances": TestNG will run all the methods in the same instance in the same thread, but two methods on two different instances will be running in different threads.
I tried simple example below as per my understanding that just opens browser .
public class TestClass {
WebDriver driver;
@Test
public void method1() {
System.out.println("method 1");
driver = new ChromeDriver();
driver.quit();
}
}
public class ParallelExample {
TestClass tc1, tc2;
@Test
public void display() {
tc1 = new TestClass();
tc1.method1();
tc2 = new TestClass();
tc2.method1();
}
}
<suite name="Suite" configfailurepolicy="continue">
<test name="test run " parallel="instances" thread-count="2">
<classes>
<class name="testngrun.ParallelExample"/>
</classes>
</test>
</suite>
I thought i am making 2 instances so they will run in parallel but they are running sequentially. Can someone explains and share some example how parallel=instances works.
Thanks !!