TestNG priority is set by the following syntax:
@Test (priority = 1)
public void func(){
//test code
}
An example of prioritization in TestNG can be as follows:
@Test (priority = 1)
public void CloseBrowser() {
driver.close();
System.out.println("Closing Google Chrome browser");
}
@Test (priority = 0)
public void OpenBrowser() {
System.out.println("Launching Google Chrome browser");
driver.get("
https://www.demoqa.com");
}
@Test (priority = 1)
public void CloseBrowser() {
driver.close();
System.out.println("Closing Google Chrome browser");
}
@Test (priority = 0)
public void OpenBrowser() {
System.out.println("Launching Google Chrome browser");
driver.get("
https://www.demoqa.com");
}