+1 vote
in TestNG by
How would you set priorities in TestNG?

1 Answer

0 votes
by
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");

 }

Related questions

+1 vote
asked Apr 19, 2021 in TestNG by rajeshsharma
+1 vote
asked Apr 19, 2021 in TestNG by rajeshsharma
...