How to Set Test Case Priority in TestNG

1
33

How to set test case priority in TestNG?

Setting Priority in TestNG

  1. //Code Snippet
  2.  
  3. package TestNG;
  4.  
  5. import org.testng.annotations.*;
  6.  
  7. public class SettingPriority {
  8.  
  9. // m1 , m2 and m3 are three methods
  10.  
  11. @Test(priority=0)
  12.  
  13. public void m1() {
  14.  
  15. }
  16.  
  17. @Test(priority=1)
  18.  
  19. public void m2() {
  20.  
  21. }
  22.  
  23. @Test(priority=2)
  24.  
  25. public void m3() {
  26.  
  27. }
  28.  
  29. }

Test Execution Sequence:
1. m1

2. m2

3. m3

Facebook Comments
(Visited 30 times, 1 visits today)

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here