InterviewSolution
Saved Bookmarks
| 1. |
What is the best way to set priority for test cases in TestNG? |
|
Answer» Prioritizing the order of your test methods can be accomplished by defining a priority order. Consequently, the test will execute in accordance with the priority set. Syntax: @Test(priority=2) Example: The following code demonstrates how to set the priority of a test case in TestNG. package TestNG;import org.testng.annotations.*; public class SettingPriority { @Test(priority=0) public void scalermethod1() { } @Test(priority=1) public void scalermethod2() { } @Test(priority=2) public void scalermethod3() { } } Test Execution Sequence: ScalerMethod1ScalerMethod2 ScalerMethod3 |
|