我已通过使用@Test批注中的priority = xxx以特定顺序订购了自动测试。
对于要测试的最后一类,优先级值从10201及更高版本开始。但是,该特定类在第一类之后就进行了测试,优先级为1-10。
有人有什么主意吗?我查看了TestNG文档-但未讨论这些值。
我查看了TestNG源代码,并且看起来priority是一个int,所以最大值将是2147483647。
实际上,您可以通过运行以下测试来轻松对其进行测试:
import org.testng.annotations.Test;
public class Testing {
@Test(priority = 2147483647)
public void testOne() {
System.out.println("Test One");
}
@Test(priority = 1)
public void testTwo() {
System.out.println("Test Two");
}
}