Unable to run Tests parallel using Grid2

1,148 views
Skip to first unread message

Raghuram

unread,
Apr 18, 2012, 2:40:19 AM4/18/12
to seleniu...@googlegroups.com
I am unable to run tests using grid2. This are the steps i followed to run the tests.

Steps followed
  1. invoked the hub by " java -jar selenium-server-standalone-2.20.0.jar -role hub"
  2. Invoked the node browser specific " java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://localhost:4444/grid/register -port 5556 -browser "browserName=firefox,version=11.0,maxInstances=5,platform=WINDOWS" "
  3. Invoked another node browser specific " java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://localhost:4444/grid/register -port 5557 -browser "browserName=iexplore,version=11.0,maxInstances=5,platform=WINDOWS" "
  4. checked the nodes by checking the URL " http://localhost:4444/grid/console "
  5. I have took some sample code from the net here is the code

File : SeleniumGridDemo1.java

package test;

import org.testng.annotations.*;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class SeleniumGridDemo1 {

public Selenium selenium;

@Parameters({"host","port","browser","url"})
@BeforeClass
public void setup(String host, String port, String browser, String url) {
selenium = new DefaultSelenium(host, Integer.parseInt(port), browser,url);
selenium.start();
selenium.open(url);
}

@AfterClass
public void tearDown() {
selenium.stop();
}

@Test
public void test_first() {
//selenium.open("/");
selenium.type("q", "First");
selenium.click("btnG");
}

@Test
public void test_second() {
//selenium.open("/");
selenium.type("q", "second");
selenium.click("btnG");
}

}

File : SeleniumGridDemo2.java

package test;
/**
 * @author Gaurang Shah
 * To demonstrate the Selenium Grid 
 */
import org.testng.annotations.*;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;


public class SeleniumGridDemo2 {
public Selenium selenium;
@Parameters({"host","port","browser","url"})
@BeforeClass
public void setup(String host, String port, String browser, String url) {
selenium = new DefaultSelenium(host, Integer.parseInt(port), browser,url);
selenium.start();
selenium.open(url);
}
@AfterClass
public void tearDown(){
selenium.stop();
}
@Test
public void test_third() { 
//selenium.open("/");
selenium.type("q","third");
selenium.click("btnG");
}
@Test
public void test_fourth() {
//selenium.open("/");
selenium.type("q","fourth");
selenium.click("btnG");
}

}

File : TestNG.xml
<suite name="SeleniumGrid" verbose="3"  parallel="classes" thread-count="2">  
<parameter name="host" value="192.168.3.63" />
<parameter name="port" value="4444" />
<parameter name="url" value="http://www.google.co.in" />
  <test name="SeleniumGridDemo1" annotations="JDK">
  <parameter name="browser" value="*firefox" />
    <classes>
      <class name="test.SeleniumGridDemo1"/>
      <methods>
 <include name="test_first" />
 <include name="test_second" />
 </methods>
    </classes>
 </test>
 <test name="SeleniumGridDemo2" annotations="JDK">
<parameter name="browser" value="*iexplore" />
    <classes>
 <class name="test.SeleniumGridDemo2"/>
 <methods>
 <include name="test_third" />
 <include name="test_fourth" />
 </methods>
    </classes>
 </test> 
 </suite>
 
6. running the test from eclipse id 
7. getting this errors


[TestRunner] Running the tests in 'SeleniumGridDemo1' with parallel mode:classes
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@658a7b6c priority: 10
[TestClass] Creating TestClass for [ClassImpl test.SeleniumGridDemo1]
[TestRunner] Running the tests in 'SeleniumGridDemo2' with parallel mode:classes
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@1abcd898 priority: 10
[TestClass] Creating TestClass for [ClassImpl test.SeleniumGridDemo2]
[TestNG] Running:
  F:\SocialTwist\HelloWorld\TestNG.xml

[SuiteRunner] Created 2 TestRunners
[TestRunner] Running test SeleniumGridDemo1 on 1  classes,  included groups:[] excluded groups:[]
===== Test class
test.SeleniumGridDemo1
  @BeforeClass SeleniumGridDemo1.setup(java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:test.SeleniumGridDemo1@3fcc9a3d]
    @Test SeleniumGridDemo1.test_second()[pri:0, instance:test.SeleniumGridDemo1@3fcc9a3d]
    @Test SeleniumGridDemo1.test_first()[pri:0, instance:test.SeleniumGridDemo1@3fcc9a3d]
  @AfterClass SeleniumGridDemo1.tearDown()[pri:0, instance:test.SeleniumGridDemo1@3fcc9a3d]
======
[TestRunner] Starting executor for test SeleniumGridDemo1 with time out:2147483647 milliseconds.
[Invoker 681477373] Invoking @BeforeClass SeleniumGridDemo1.setup(java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:test.SeleniumGridDemo1@3fcc9a3d]
Failed to invoke configuration method test.SeleniumGridDemo1.setup:Could not start Selenium session: org.openqa.grid.common.exception.GridException: Error forwarding the new session cannot find : {browserName=*firefox}
===== Invoked methods
  SeleniumGridDemo1.setup(java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:test.SeleniumGridDemo1@3fcc9a3d]192.168.3.63 4444 *firefox http://www.google.co.in  1070373437
    SeleniumGridDemo1.test_first()[pri:0, instance:test.SeleniumGridDemo1@3fcc9a3d] 1070373437
    SeleniumGridDemo1.test_second()[pri:0, instance:test.SeleniumGridDemo1@3fcc9a3d] 1070373437
=====
Creating F:\SocialTwist\HelloWorld\test-output\SeleniumGrid\SeleniumGridDemo1.html
Creating F:\SocialTwist\HelloWorld\test-output\SeleniumGrid\SeleniumGridDemo1.xml
FAILED CONFIGURATION: @BeforeClass setup("192.168.3.63", "4444", "*firefox", "http://www.google.co.in")
java.lang.RuntimeException: Could not start Selenium session: org.openqa.grid.common.exception.GridException: Error forwarding the new session cannot find : {browserName=*firefox}
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109)
at test.SeleniumGridDemo1.setup(SeleniumGridDemo1.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:551)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.thoughtworks.selenium.SeleniumException: org.openqa.grid.common.exception.GridException: Error forwarding the new session cannot find : {browserName=*firefox}
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:112)
at com.thoughtworks.selenium.HttpCommandProcessor.getCommandResponseAsString(HttpCommandProcessor.java:183)
at com.thoughtworks.selenium.HttpCommandProcessor.executeCommandOnServlet(HttpCommandProcessor.java:118)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:101)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:275)
at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:237)
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:100)
... 14 more

SKIPPED CONFIGURATION: @AfterClass tearDown
SKIPPED: test_first
SKIPPED: test_second

===============================================
    SeleniumGridDemo1
    Tests run: 2, Failures: 0, Skips: 2
    Configuration Failures: 1, Skips: 1
===============================================

[TestRunner] Running test SeleniumGridDemo2 on 1  classes,  included groups:[] excluded groups:[]
===== Test class
test.SeleniumGridDemo2
  @BeforeClass SeleniumGridDemo2.setup(java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:test.SeleniumGridDemo2@d1af848]
    @Test SeleniumGridDemo2.test_third()[pri:0, instance:test.SeleniumGridDemo2@d1af848]
    @Test SeleniumGridDemo2.test_fourth()[pri:0, instance:test.SeleniumGridDemo2@d1af848]
  @AfterClass SeleniumGridDemo2.tearDown()[pri:0, instance:test.SeleniumGridDemo2@d1af848]
======
[TestRunner] Starting executor for test SeleniumGridDemo2 with time out:2147483647 milliseconds.
[Invoker 216942577] Invoking @BeforeClass SeleniumGridDemo2.setup(java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:test.SeleniumGridDemo2@d1af848]
Failed to invoke configuration method test.SeleniumGridDemo2.setup:Could not start Selenium session: org.openqa.grid.common.exception.GridException: Error forwarding the new session cannot find : {browserName=*iexplore}
===== Invoked methods
  SeleniumGridDemo2.setup(java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:test.SeleniumGridDemo2@d1af848]192.168.3.63 4444 *iexplore http://www.google.co.in  219871304
    SeleniumGridDemo2.test_third()[pri:0, instance:test.SeleniumGridDemo2@d1af848] 219871304
    SeleniumGridDemo2.test_fourth()[pri:0, instance:test.SeleniumGridDemo2@d1af848] 219871304
=====
Creating F:\SocialTwist\HelloWorld\test-output\SeleniumGrid\SeleniumGridDemo2.html
Creating F:\SocialTwist\HelloWorld\test-output\SeleniumGrid\SeleniumGridDemo2.xml
FAILED CONFIGURATION: @BeforeClass setup("192.168.3.63", "4444", "*iexplore", "http://www.google.co.in")
java.lang.RuntimeException: Could not start Selenium session: org.openqa.grid.common.exception.GridException: Error forwarding the new session cannot find : {browserName=*iexplore}
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109)
at test.SeleniumGridDemo2.setup(SeleniumGridDemo2.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:551)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.thoughtworks.selenium.SeleniumException: org.openqa.grid.common.exception.GridException: Error forwarding the new session cannot find : {browserName=*iexplore}
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:112)
at com.thoughtworks.selenium.HttpCommandProcessor.getCommandResponseAsString(HttpCommandProcessor.java:183)
at com.thoughtworks.selenium.HttpCommandProcessor.executeCommandOnServlet(HttpCommandProcessor.java:118)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:101)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:275)
at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:237)
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:100)
... 14 more

SKIPPED CONFIGURATION: @AfterClass tearDown
SKIPPED: test_third
SKIPPED: test_fourth

===============================================
    SeleniumGridDemo2
    Tests run: 2, Failures: 0, Skips: 2
    Configuration Failures: 1, Skips: 1
===============================================


===============================================
SeleniumGrid
Total tests run: 4, Failures: 0, Skips: 4
Configuration Failures: 2, Skips: 2
===============================================

Creating F:\SocialTwist\HelloWorld\test-output\testng-results.xml
[TestNG] Time taken by org.testng.reporters.XMLReporter@1f80a5bf: 38 ms
Creating F:\SocialTwist\HelloWorld\test-output\junitreports\TEST-test.SeleniumGridDemo1.xml
Creating F:\SocialTwist\HelloWorld\test-output\junitreports\TEST-test.SeleniumGridDemo2.xml
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@4c6aacbf: 13 ms
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\toc.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\SeleniumGridDemo2.properties
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\SeleniumGridDemo1.properties
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\index.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\main.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\groups.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-alphabetical.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-alphabetical.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-alphabetical.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-alphabetical.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-alphabetical.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-alphabetical.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-alphabetical.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-alphabetical.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\classes.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\reporter-output.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\methods-not-run.html
Creating F:\SocialTwist\HelloWorld\test-output\old\SeleniumGrid\testng.xml.html
Creating F:\SocialTwist\HelloWorld\test-output\old\index.html
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@2f6c3396: 30 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter@28db4ccf: 8 ms
Creating F:\SocialTwist\HelloWorld\test-output\testng-failed.xml
Creating F:\SocialTwist\HelloWorld\test-output\SeleniumGrid\testng-failed.xml
[TestNG] Time taken by [TestListenerAdapter] Passed:0 Failed:0 Skipped:0]: 31 ms
Creating F:\SocialTwist\HelloWorld\test-output\index.html
[TestNG] Time taken by org.testng.reporters.jq.Main@66218741: 35 ms

Can some one please help me in solving the issue

Thanks
Raghuram.

Krishnan Mahadevan

unread,
Apr 18, 2012, 4:07:19 AM4/18/12
to seleniu...@googlegroups.com
The problem is because of the way in which you are starting off your webdriver nodes

Invoked the node browser specific " java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://localhost:4444/grid/register -port 5556 -browser "browserName=firefox,version=11.0,maxInstances=5,platform=WINDOWS" "
Invoked another node browser specific " java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://localhost:4444/grid/register -port 5557 -browser "browserName=iexplore,version=11.0,maxInstances=5,platform=WINDOWS" "

When you specify the browser flavors as above, you essentially are configuring your webdriver node to only support WebDriver mode (type=WebDriver) and no Selenium mode (type=Selenium) 

That is why you are seeing the Grid complain to you stating 

Caused by: com.thoughtworks.selenium.SeleniumException: org.openqa.grid.common.exception.GridException: Error forwarding the new session cannot find : {browserName=*iexplore}

Caused by: com.thoughtworks.selenium.SeleniumException: org.openqa.grid.common.exception.GridException: Error forwarding the new session cannot find : {browserName=*firefox}

You can cross check this by launching your hub console and doing a mouse move over on the browser icons. You will only see the browser name as "internet explorer" and "firefox" respectively.
Can you please just retry with using

java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://localhost:4444/grid/register -port 5557

What this essentially gives you is :

5 FF instances, 5 chrome instances and 1 IE instance that supports both

WebDriver driver = new RemoteWebDriver() //WebDriver mode  and
DefaultSelenium selenium = new DefaultSelenium() //legacy Selenium mode.

If you would like to tweak the capabilities of the webdriver node when it is being spawned, you should really look at using node configuration JSON files.


Wherein I have tried to detail as much as I can on how you can start off your grid and webdriver nodes and also how to work with leveraging JSON node configuration files.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



Raghuram.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/VQ3QOOHEnq4J.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Monojit Debnath

unread,
Dec 12, 2013, 4:25:41 AM12/12/13
to seleniu...@googlegroups.com
Hi Krishnan

I was facing the simmilar problem but its resolved now, but the another problem is my rc test contains 69 suites, some of suites are missing in the test results, the result is something like below
 
MODULETOTALPASSEDFAILEDLINK
SETUP909link
SMOKE56056link
Total65065 
 
whereas  the total count should me 69. 4 smoke modules are missing. Can u give me a solution to this. I am using selenium version 2.35.0, firefox version 5.0, teamcity version 6.5.5

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Krishnan Mahadevan

unread,
Dec 12, 2013, 4:54:40 AM12/12/13
to Selenium Users
Why do you think this issue of yours is related to WebDriver/Selenium ?

I would suggest that you post a trimmed version of your query either in the JUnit or TestNG forums.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages