testng - @Test 注释的优先级最大值是多少

testng - what is the maximum value for priority for @Test annotation

我已经通过在@Test 注释中使用 priority=xxx 以特定顺序命令了自动化测试。

要测试的最后一个class,优先级值从10201及以上开始。但是,这个特定的 class 是在第一个 class 之后测试的,优先级为 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");
    }
}