1.

How To Set Test Case Priority In Testng?

Answer»

We use priority attribute to the @Test ANNOTATIONS. In case priority is not set then the test SCRIPTS execute in alphabetical order.

  1. // TESTNG INTERVIEW Questions
  2. package TestNG;
  3. import org.testng.annotations.*;
  4. public class PriorityTestCase{
  5. @Test(priority=0)
  6. public void testCase1() {
  7. system.out.println("Test Case 1");
  8. }
  9. @Test(priority=1)
  10. public void testCase2() {
  11. system.out.println("Test Case 2");
  12. }
  13. }

Output:

  1. Test Case 1
  2. Test Case 2

We use priority attribute to the @Test annotations. In case priority is not set then the test scripts execute in alphabetical order.

Output:



Discussion

No Comment Found