相关疑难解决方法(0)

TestNG使用多个DataProviders和单一测试方法

我一直在寻找一种在我的测试方法中使用多个DataProviders的方法.我的方案如下:

假设我们有一个DataProvider类:

@Test
public class ExampleDataProvider {

   /**
     * Returns the list of shape codes.
     * 
     * @return the collection shape codes.
     */
    @DataProvider(name = "ShapeCodes")
    public static Object[][] getShapeCodes() {
        return new Object[][] { new Object[] { Shape.Square }, 
            new Object[] { Shape.Triangle }
        };
    }

    /**
     * Returns the list of color codes.
     * 
     * @return the collection of color codes.
     */
    @DataProvider(name = "ColorCodes")
    public static Object[][] geColorCodes() {
        return new Object[][] { new Object[] { Color.Green …
Run Code Online (Sandbox Code Playgroud)

java testing testng automation

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

automation ×1

java ×1

testing ×1

testng ×1