Interview Questions

Selenium WebDriver - How to set test case priority in TestNG?

Selenium WebDriver Interview question and Answers


(Continued from previous question...)

Selenium WebDriver - How to set test case priority in TestNG?

Setting Priority in TestNG
Code Snippet
1 package TestNG;
2 import org.testng.annotations.*;
3 public class SettingPriority {
4 @Test(priority=0)
5 public void method1() {
6 }
7 @Test(priority=1)
8 public void method2() {
9 }
10 @Test(priority=2)
11 public void method3() {
12 }
13 }

Test Execution Sequence:

Method1
Method2
Method3

(Continued on next question...)

Other Interview Questions