How To Prioritise The Test Cases Using TestNG Priority keyword
Posted By : Manish Kumar | 30-Jan-2018
We all know basic use of TestNG and use it for Automation testing Script, but simply using TestNG @Test annotation has one issue in its by default settings.
package exampleTestPriority; import org.openqa.selenium.WebDriver; import org.testng.annotations.Test; public class TestCases { public WebDriver driver; @Test(priority = 0) public void One_1() { System.out.println("Test Case number One(1)"); } @Test(priority = 1) public void Two_2() { System.out.println("Test Case number Two(2)"); } @Test(priority = 2) public void Three_3() { System.out.println("Test Case number Three(3)"); } @Test(priority = 3) public void Four_4() { System.out.println("Test Case number Four(4)"); } }
Test Case number One(1) Test Case number Two(2) Test Case number Three(3) Test Case number Four(4) Passed: One_1 Passed: Two_2 Passed: Three_3 Passed: Four_4
Thanks.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Manish Kumar
Manish is Adaptive and passionate to learn new technical skills, have knowledge of testing and love to play badminton in free time