2
喜並行運行超過10次測試中,我設計了一個Selenium測試在並行(25)無法通過TestNG的數據提供程序
@Test(dataProvider = "getData")
public void multiUserTest(String url, String username, String password)
throws InterruptedException, IOException, FindFailed {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setBrowserName(prop.getProperty("browserName"));
capabilities.setPlatform(Platform.WINDOWS);
RemoteWebDriver driver = new RemoteWebDriver(new URL(prop.getProperty("url")), capabilities);
WebDriverWait wait = new WebDriverWait(driver, 720); // 12 minutes wait.
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
try {
driver.get(url);
driver.findElement(By.xpath(prop.getProperty("username"))).sendKeys(username);
driver.findElement(By.xpath(prop.getProperty("password"))).sendKeys(password);
driver.findElement(By.xpath(prop.getProperty("signin"))).click();
}catch (Exception e) {
e.printStackTrace();
}
我的數據提供
@DataProvider(parallel = true)
public Object[][] getData() {
Object data[][] = new Object[25][3];
// row 1
data[0][0] = "http:XXXX/login.html";
data[0][1] = "[email protected]";
data[0][2] = "[email protected]";
// row 2
data[1][0] = "http:XXXX/login.html";
data[1][1] = "[email protected]";
data[1][2] = "[email protected]";
..........
// row 25
data[24][0] = "http:XXXX/login.html";
data[24][1] = "[email protected]";
data[24][2] = "[email protected]";
和我的XML運行文件是
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods" thread-count="1" data-provider-thread-count="25">
<test name="Test">
<classes>
<class name="XXX.MultiUserGuiTest"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
現在,當我運行我的上述測試它運行10次測試一次去和第10次測試後已完成,然後下一個1 0開始執行之後是5,但 我想運行我的測試,其中25應立即
僅供參考我加入我的EC2實例的截圖開始執行。有25鉻,起來和運行也請看看鼠標懸停在鉻瀏覽器
你在哪裏在本地或網格上運行測試? – Paras
在網格上。我們購買了亞馬遜EC2實例用於我們的測試 –
您可以檢查在網格計算機上安裝了多少節點以及它們的最大實例嗎? – Paras