views:

374

answers:

1

Hello, I'm writing a selenium grid test suite which is going to be run on a series of different machines. I wrote most of it on my macbook but have recently transfered it over to my work machine, which is running ubuntu 9.04. That's actually my first experience with a linux machine, so I may be missing something very simple (I have disabled the firewall though).

I haven't been able to get the multienvironment thing working at all, and I've been trying and manual reviewing for a while. Any recommendations and help would be greatly, greatly appreciated!

The error I'm getting when I run the test is:

[java] FAILED CONFIGURATION: @BeforeMethod startFirstEnvironment("localhost", 4444, "*safari", "http://remoteURL:8080/tutor") [java] java.lang.RuntimeException: Could not start Selenium session: ERROR: Connection refused

I thought it might be the mac refusing the connection, but using wireshark I determined that no connection attempt was made on the mac . Here's the code for setting up the session, which is where it seems to be dying

  @BeforeMethod(groups = {"default", "example"}, alwaysRun = true)

  @Parameters({"seleniumHost", "seleniumPort", "firstEnvironment", "webSite"})
  protected void startFirstEnvironment(String seleniumHost, int seleniumPort, String firstEnvironment, String webSite) throws Exception {

 try{
startSeleniumSession(seleniumHost, seleniumPort, firstEnvironment, webSite);
session().setTimeout(TIMEOUT);

  } finally {

  closeSeleniumSession();

  }

}

@BeforeMethod(groups = {"default", "example"}, alwaysRun = true)
@Parameters({"seleniumHost", "seleniumPort", "secondEnvironment", "webSite"})

  protected void startSecondEnvironment(String seleniumHost, int seleniumPort, String    secondEnvironment, String webSite) throws Exception {
 try{
    startSeleniumSession(seleniumHost, seleniumPort, secondEnvironment, webSite); 
session().setTimeout(TIMEOUT);
    } finally {
        closeSeleniumSession();
    }
}

and the accompanying build script used to run the test

  <target name="runMulti" depends="compile" description="Run Selenium tests in parallel (20 threads)">
      <echo>${seleniumHost}</echo>
   <java classpathref="runtime.classpath"
   classname="org.testng.TestNG"
   failonerror="true">

 <sysproperty key="java.security.policy" file="${rootdir}/lib/testng.policy"/>
 <sysproperty key="webSite" value="${webSite}" />
 <sysproperty key="seleniumHost" value="${seleniumHost}" />
 <sysproperty key="seleniumPort" value="${seleniumPort}" />
 <sysproperty key="firstEnvironment" value="${firstEnvironment}" />
 <sysproperty key="secondEnvironment" value="${secondEnvironment}" />
 <arg value="-d" />
 <arg value="${basedir}/target/reports" />
 <arg value="-suitename" />
 <arg value="Selenium Grid Java Sample Test Suite" />
 <arg value="-parallel"/>
 <arg value="methods"/>
 <arg value="-threadcount"/>
 <arg value="15"/>
 <arg value="testng.xml"/>
</java>

A: 

Yeah, I feel silly. After considerable fiddling I realized that changing the seleniumHost attribute in the build file to the IP of the machine running that instance of selenium-RC. Having it as local host was just making a loop, or something like that.

ReadyWater