@Test(priority = x)设置测试用例执行优先级。
x默认为0,0的优先级最高,0>1>2>3...
import org.testng.annotations.Test;
public class PriorityTest {
@Test(priority = 3)
public void priorityTest1(){
System.out.println("priorityTest1 运行");
}
@Test(priority = 2)
public void priorityTest2(){
System.out.println("priorityTest2 运行");
}
@Test(priority = 1)
public void priorityTest3(){
System.out.println("priorityTest3 运行");
}
@Test(priority = 0)
public void priorityTest4(){
System.out.println("priorityTest4 运行");
}
}
执行结果为:
priorityTest4 运行
priorityTest3 运行
priorityTest2 运行
priorityTest1 运行
网友评论