ITSourceCode.com

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
(Visited 3 times, 1 visits today)
Share this

Check Your Domain Ranking

1 Comment

Add a Comment
  1. Nice article about prioritizing the Test Cases using TestNG.Selenium Training gives the overall picture about the TestNG and it’s annotations.

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!




%d bloggers like this: