TestNG + Selenium Grid,只有一个RC运行,

时间:2010-01-07 12:19:32

标签: testng selenium-grid

我正在使用Selenium Grid和TestNG来测试一个网站。我从Selenium IDE导出的测试代码工作正常。我的问题是,测试是顺序运行的,而不是并行运行。

以下是代码:

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看起来像这样:

suite thread-count =“5”skipfailedinvocationCounts =“false”verbose =“1”name =“命令行套件”junit =“false”parallel =“methods”annotations =“JDK”

我做错了什么?该测试仅在一个Selenium RC上运行,但启动了多个。

我希望有人可以帮助我,这非常重要。

谢谢!

1 个答案:

答案 0 :(得分:1)

升级到TestNG 5.11,它实现了并行数据提供程序。以前的版本总是在同一个线程中调用所有数据提供者调用...

- 塞德里克

相关问题