Is there a way to set priorities among classes execution in TestNG? Is there some annotation or xml settings? Thanks.
CodePudding user response:
It can be achieved in testng.xml file. Order of classes is important in the file, and just run directly this file.
CodePudding user response:
@Test(priority = 1)
public void testMethodA() {
System.out.println("Executing - testMethodA");
}
@Test
public void testMethodB() {
System.out.println("Executing - testMethodB");
}
@Test(priority = 2)
public void testMethodC() {
System.out.println("Executing - testMethodC");
}
Output
Executing - testMethodB
Executing - testMethodA
Executing-testMethodC
testMethodB got executed first as it had a default priority of 0