I'm working on modifying our existing Selenium Grid setup so that it will work with Selenium 2. The process of setting up the hub and nodes seems to be much simpler, but I'm having a problem getting it running in an Ant build the way I did before.
I've read through the wiki on Selenium 2 Grid and tried to set up the Ant build accordingly. My problem is that the first target runs, starting the hub. Then, the other targets do not run, but the build completes. I'm attempting to run these on my own machine, with Selenium 1 (RC) Junit tests, and TestNG as a test runner.
The targets I have are as follows:
<taskdef resource="testngtasks" classpath="testng-${testng.version}.jar" />
<target name="start-hub" description="Start the Selenium Grid hub">
<java classpathref="runtime.classpath"
jar="${basedir}/selenium-server-standalone-${server.version}.jar"
fork="true"
spawn="true">
<arg value="-v" />
<arg value="-role" />
<arg value="hub" />
</java>
</target>
<target name="start-node"
description="Start the Selenium Grid node"
depends="start-hub">
<java classpathref="runtime.classpath"
jar="${basedir}/selenium-server-standalone-${server.version}.jar"
fork="true"
spawn="true">
<arg value="-role" />
<arg value="rc" />
<arg value="-hub" />
<arg value="http://localhost:4444/grid/register" />
<arg value="-port" />
<arg value="5555" />
<arg value="-browser" />
<arg value="browserName=firefox,version=3.6,maxInstances=5,platform=WINDOWS"/>
</java>
</target>
<target name="run-tests" description="Run the tests" depends="start-node">
<testng classpathref="runtime.classpath"
haltonfailure="true">
<sysproperty key="java.security.policy"
file="${grid.location}/lib/testng.policy" />
<arg value="testng.xml"/>
</testng>
</target>
It seems like the Ant thread is finished after the first target runs. I looked at a way to start them in a new window, like the previous grid, but I didn't see a way to do that except for the exec
task. I also tried running the hub in an exec
task and the node as a java
task. That resulted in the ant build stopping execution after the start-hub
target as opposed to finishing.
Is there a way I can get this running, or is there a better way to accomplish it?