2010-01-07 77 views
1

我正在使用Selenium網格和TestNG來測試一個網站。我從Selenium IDE導出的測試代碼正常工作。我的問題是,測試順序運行,而不是平行運行。TestNG +硒網格,只有一個RC運行,

下面是代碼:

public class test{ 

    @BeforeMethod 
    public void startSession() 
    { 
     ThreadSafeSeleniumSessionStorage.startSeleniumSession("localhost",4444,"*firefox","url"); 
    } 

    @AfterMethod(alwaysRun = true) 
    public void closeSession() throws Exception 
    { 
     ThreadSafeSeleniumSessionStorage.closeSeleniumSession(); 
    } 

    @DataProvider(name = "test") 
    public Object[][] test() 
    { 
     return new Object[][]{ 
     {test1,null}, 
     {test2,null}, 
     }; 
} 

@Test(dataProvider = "test") 
void testen(String value1, String value2) throws Exception 
    { 
    ThreadSafeSeleniumSessionStorage.session().open("url"); 
    . 
    . 
    . 
    . 
    . 
    ThreadSafeSeleniumSessionStorage.session().waitForPageToLoad("30000"); 
    } 

} 

我的testng.xml看起來是這樣的:

套房針數= 「5」 skipfailedinvocationCounts = 「假」 詳細= 「1」 NAME =「命令line suite「junit =」false「parallel =」methods「annotations =」JDK「

我在做什麼錯?測試僅在一個Selenium RC上運行,但不止一個啓動。

我希望有人能幫助我,這真的很重要。

謝謝!

回答

1

升級到TestNG 5.11,它實現了並行數據提供者。以前的版本總是調用同一線程中的所有數據提供者調用...

- Cedric