ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

How to set test case priority in TestNG?

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

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!