I have the following xml file:
<suite name= "Ecommerce suite" group-by-instances="true" parallel="methods">
<test name = "Sanity tests" verbose = "2" >
<classes>
<class name = "tutorialTestNG.Search">
</class>
<class name = "tutorialTestNG.AccountFunds">
</class>
</classes>
</test>
and these two classes:
public class Search {
@BeforeTest
public void login(){
System.out.println("Successfully logged in!");
}
@AfterTest
public void logout(){
System.out.println("Successfully logged out!");
}
@Test (priority = 1)
public void search(){
System.out.println("Successfully searched!");
}
@Test (priority = 2)
public void advancedSearch(){
System.out.println("Successfully advance searched!");
}
@Test (priority = 3)
public void buyProducts(){
System.out.println("Successfully bought products!");
}
}
public class AccountFunds {
@Test (priority = 1)
public void accountSummary(){
System.out.println("Successfully brought summary of the account!");
}
@Test (priority = 2)
public void fundTransfer(){
System.out.println("Successfully transferred funds!");
}
@Test (priority = 3)
public void billPayment(){
System.out.println("Successfully paid bills!");
}
}
The problem is that when i run the test suite, the methods from both classes with priority = 1 are ran, instead of all methods from one class first and then the other methods from second class. So the output is something like this:
Successfully logged in!
Successfully searched!
Successfully brought summary of the account!
Successfully advance searched!
Successfully transferred funds!
Successfully bought products!
Successfully paid bills!
Successfully logged out!
Any idea why this occurs even though i set group-by-instances variable true?