我在寻找去除(更换)从@dataProvider公共静态对象的硬编码的浏览器/操作系统/版本值[] [] sauceBrowserDataProvider的建议。 代码示例:
@DataProvider(name = "hardCodedBrowsers", parallel = true)
public static Object[][] sauceBrowserDataProvider(Method testMethod) {
return new Object[][]{
**new Object[]{"firefox", "55.0", "Windows 10"},
new Object[]{"chrome", "65.0", "Windows 10"},**
};}
@Test( dataProvider = "hardCodedBrowsers")
public void createDriver(String browser, String version, String os)
throws Exception {
Class<? extends TestRemote> SLclass = this.getClass();
DesiredCapabilities capabilities = new DesiredCapabilities();
// set desired capabilities to launch appropriate browser on Sauce
capabilities.setCapability(CapabilityType.BROWSER_NAME, browser);
capabilities.setCapability(CapabilityType.VERSION, version);
capabilities.setCapability(CapabilityType.PLATFORM_NAME, os);
capabilities.setCapability("seleniumVersion", "3.8.1");
capabilities.setCapability("name", SLclass.getSimpleName());
capabilities.setCapability("screenResolution", "1920x1080");
driver = (new RemoteWebDriver(new URL("http://" + SAUCE_USERNAME + ":" + SAUCE_ACCESS_KEY + "@ondemand.saucelabs.com:80/wd/hub"), capabilities));
configRead = new ConfigFileReader();
propertyRead = new PropertyLoader();
baseUrl = propertyRead.getProperty("site.url");
app = new Application(driver);
getURL();
}
这是Java中的硒项目/ TestNG中/詹金斯/ Saucelabs