Question

I am using Selenium Grid with TestNG to test a website. The test-code, that i exported from the Selenium IDE works fine. My problem is, the tests are running sequential, not parallel.

Here is the code:

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");
    }

}

My testng.xml looks like this:

suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="Command line suite" junit="false" parallel="methods" annotations="JDK"

What am I doing wrong? The test runs only on one Selenium RC, although more than one are started.

I hope someone can help me, it is really important.

Thanks!

Was it helpful?

Solution

Upgrade to TestNG 5.11, which implements parallel data providers. The previous versions always invoked all the data provider calls in the same thread...

-- Cedric

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top