我正在尝试概述如何实现Factory以在我定义的所有浏览器上测试测试类。有一个更好的方法吗。任何人都可以建议一个基本的改进吗?
public class FactoryDataProviderTestBase extends MyTestBase
{
@Factory(dataProvider = "dp")
public FactoryDataProviderTestBase( SauceTestHelper helper,
Map<String,String> csvArgMap ) {
super( helper, csvArgMap );
}
@DataProvider( name = "factory" )
static public Object[][] factoryDataProvider() {
// do stuff here to initialize csvArgMap from csv file
return new Object[][] {
new Object[] { new SauceTestHelper(browser.FirefoxLatest), argMap },
new Object[] { new SauceTestHelper(browser.IE8), argMap },
new Object[] { new SauceTestHelper(browser.IE9), argMap },
new Object[] { new SauceTestHelper(browser.IE10), argMap },
new Object[] { new SauceTestHelper(browser.IE11), argMap },
new Object[] { new SauceTestHelper(browser.Safari7), argMap },
new Object[] { new SauceTestHelper(browser.Chrome), argMap }
};
}
}
在上面的代码中,TestNG应该创建类FactoryDataProviderTestBase的多个实例,每个实例定义一个浏览器?