views:

439

answers:

3

I am trying to get Selenium Grid to run using NAnt but am a little lost, as all explanations I can find use Ant - although I thought they were fairly similar, I can't seem to fire off Selenium Grid on my local PC in this way.

Here's the URLs to the Selenium Grid pages online that I've found, but they refer to Ant...

Get started

...leading on to

Run the demo

+1  A: 

From the Selenium Grid page:

To run Selenium Grid, you need a valid Java 5+ JDK install on your system.

AFAIK NAnt is designed to work with .Net, not Java, so I think your best bet is to install Ant, Java 1.5 and Selenium Grid per the instructions, then invoke the ant task with a NAnt exec task.

Rich Seller
Yeah - I thought you was going to say that. I think I expected to be able to run Grid under NAnt, being as that NAnt is a port of Ant, but obviously not. Thank you very much for your answer.
Brett Rigby
sorry it's not more help, maybe someone with more NAnt knowledge can suggest a way to write a custom task to achieve this
Rich Seller
It sounds like a decent enough workaround to the problem, to be honest. If it needs Ant to run, then I'll try to fire it off with that and then call it from NAnt like you say. What's the worst that can happen?
Brett Rigby
+1  A: 

it is easy:

  <property name="selenium.server.file" value="${src.dir}\_tools\selenium\selenium-server.jar" />
  <property name="selenium.grid.hub.file" value="${src.dir}\_tools\selenium\selenium-grid-hub-standalone-1.0.4.jar" />
  <property name="selenium.grid.rc.file" value="${src.dir}\_tools\selenium\selenium-grid-remote-control-standalone-1.0.4.jar" />

start hub:

 <target name="start.selenium.grid.hub">
    <exec program="java" verbose="true" failonerror="false">
      <arg value="-jar" />
      <arg value="${selenium.grid.hub.file}" />
    </exec>
  </target>

start rc:

<target name="start.selenium.grid.rc">
    <exec program="java" verbose="true" failonerror="false">
      <arg value="-classpath" />
      <arg value="${selenium.server.file};${selenium.grid.rc.file}" />
      <arg value="com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControlLauncher" />
    </exec>
  </target>

or simply from command line:

java -jar D:\work\SeleniumDesign\build_artifacts\artifacts\continuous\source_tools\selenium\selenium-grid-hub-standalone-1.0.4.jar

and

java -classpath D:\work\SeleniumDesign\build_artifacts\artifacts\continuous\source_tools\selenium\selenium-server.jar;D:\work\SeleniumDesign\build_artifacts\artifacts\continuous\source_tools\selenium\selenium-grid-remote-control-standalone-1.0.4.jar com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControlLauncher

Yauheni Sivukha
A: 

small clarification,i tried from command line.

it is trying to connect to localhost:4444 default .my hub is running in different machine.

sasikumar