我一直在寻找一种在我的测试方法中使用多个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)