https://www.cnblogs.com/haigege/p/5450742.html
https://www.cnblogs.com/Roger1227/p/3851159.html
https://testng.org/doc/documentation-main.html#parameters

-1. @Parameters

public class Test1 {
    
    @Parameters({"para1", "para2", "para3"})
    @Test
    public void test1(String para1, int para2, String para3) {
        System.out.println(para1);
        System.out.println(para2);
        System.out.println(para3);
    }
}

<suite name="suite1">
    <parameter name="para1" value="xxx" />
    <parameter name="para2" value="yyy" />
    <parameter name="para3" value="zzz" />

    <test name="test1" verbose="2">
        <classes>
            <class name="classExample.Test1" />
          </classes>    
    </test>
    
</suite>

-2. @DataProvider
https://hiwanglong.github.io/2017/12/testng---dataprovider/

-3. ITestContext

    @DataProvider
    public Object[][] randomIntegers(ITestContext context) {
        String[] groups = context.getIncludedGroups();
        int size = 2;
        for (String group : groups) {
            System.out.println("--------------" + group);
            if (group.equals("function-test")) {
                size = 10;
                break;
            }
        }

        Object[][] result = new Object[size][];
        Random r = new Random();
        for (int i = 0; i < size; i++) {
            result[i] = new Object[] { new Integer(r.nextInt()) };
        }

        return result;
    }

    // 如果在 unite-test 组中执行, 将返回2个随机整数构成数组;
    // 如果在 function-test 组中执行, 将返回 10 个随机整数构成数组
    @Test(dataProvider = "randomIntegers", groups = { "unit-test", "function-test" })
    public void random(Integer n) {
        System.out.println(n);
    }

通过 testng.xml 指定运行 unite-test 组还是 function-test 组