0
votes

I am new to Grid and am trying to set up Grid 2 in Selenium RC.

I have downloaded the selenium-server-standalone-2.1.0.jar. Also I have my TestNG test cases.

And I have a test XML like:

<suite thread-count="1" name="Suite" parallel="tests" verbose="10"><!-- tests -->
        <test name="FFTest" preserve-order="true">
        <parameter name="selenium.host" value="localhost"></parameter>
        <parameter name="selenium.port" value="5569"></parameter>
        <parameter name="selenium.browser" value="*firefox"></parameter>
        <parameter name="selenium.url" value="http://www.google.com"></parameter>
        <classes>

            <class name="EmployeeHealth.TestScripts.EmployeeHealthRegressionSuite">
                <methods>
                    <include name="InitScript"></include> 
                    <include name="SelectAvoidableAdmissionModule"></include>
                    </methods>  
            </class>


        </classes>
    </test>
<test name="IETest" preserve-order="true">
    <parameter name="selenium.host" value="localhost"></parameter>
    <parameter name="selenium.port" value="5579"></parameter>
    <parameter name="selenium.browser" value="*iehta"></parameter>
    <parameter name="selenium.url" value="http://www.google.com"></parameter>
    <classes>

        <class name="EmployeeHealth.TestScripts.EmployeeHealthRegressionSuite">
            <methods>
                <include name="InitScript"></include> 
                <include name="SelectAvoidableAdmissionModule"></include>
                </methods>  
        </class>


    </classes>
</test>
</suite>    

And I followed the below steps:

Start Hub:

        java -jar selenium-server-standalone-2.5.0.jar -role hub

Start remote control supporting Firefox

        java -jar selenium-server-standalone-2.5.0.jar -role RC -hub http://localhost:4444/grid/register -browser browserName=firefox,platform=WINDOWS -port 5579

Start another RC supporting Internet explore

        java -jar selenium-server-standalone-2.5.0.jar -role RC -hub http://localhost:4444/grid/register -browser browserName=iexplore,platform=WINDOWS -port 5556.

And in my SetUp.java file, Am creating the selenium objects like:

        selenium =  new DefaultSelenium(host,Integer.parseInt(port),
                        browser, url);


                if ( browser.equalsIgnoreCase("*chrome")) {
                    RemoteControlConfiguration rcc = new RemoteControlConfiguration();
                    rcc.setFirefoxProfileTemplate(new File(
                            "test\\Resources\\ThirdParty\\FirefoxProfile\\"));
                    seleniumServer = new SeleniumServer(rcc);

                } else {
                    RemoteControlConfiguration rcc = new RemoteControlConfiguration();
                    rcc.setFirefoxProfileTemplate(new File("Object Repository\\SSL"));
                            //"src\\Script\\lib\\ThirdParty\\FirefoxProfile\\"));C:\\Biju\\NewFrameworkStrcuture\\Framework\\ABC_JSAF\\

                    seleniumServer = new SeleniumServer(rcc);
                    RemoteControlConfiguration a= seleniumServer.getConfiguration();
                    File uimap=new File("src\\Script\\lib\\user-extensions.js");
                    a.setUserExtensions(uimap);
                    //seleniumServer = new SeleniumServer();
                }
                //seleniumServer.start();
                selenium.start();
                selenium.windowMaximize();
                selenium.windowFocus();

By this way, when am running the xml file, the tests are running in sequence(First Firefox and then the IE). But not in parallel.

Also i tried giving the @Test parameter like

  @Test(dataProvider="CommonTestData",threadPoolSize = 3)

But i dont see any change in the seqence.

do any one got why this is happening?..

Appreciate for your help.


A J, Thanks for the reply.

I did changes in the XML suite and I made the dataprovider function as "parallel=true" and also added the Invokation function @Test parameter "InvoationCount=2",and configure the node and am able to launch 1 IE and 1 FF parallel.

But now the problem is, in one browser(Say IE), my test cases are executing perfectly.But in the other browser(FF) ,after launching the browser, I don't see any other action performing on it.Not even opening my URL. in the console I got error : "FAILED CONFIGURATION: @BeforeClass Seleniumstart ("localhost", "5569", "*firefox", "http://www.google.com") com.thoughtworks.selenium.SeleniumException: ERROR Server Exception: sessionId should not be
null; has this session been started yet?" Any idea on this?..

2

2 Answers

1
votes

If you are using dataprovider, you also need to mention whether it should be called in parallel. Your CommonTestData method should have parallel=true option.

For executing using the XML, you need to increase the thread count to more than 1 for parallel execution.

0
votes

It looks like your Firefox XML config tries to send the test to a node on port 5569. But in your actual client node connection string you are assigning it to use port 5579. It also looks like your IE settings attempt to use 5579 but are started with 5556.