I was trying to setup Selenium Grid and instead of using ant configuration available with Selenium Grid download I continued using my ant configuration.
For ant users who are not aware of Selenium Gird – it is a java lib which lets UI tests be distributed on different system specified in one “yml” file. Herein I can start one hub machine and which in turn can ctrl browser on different slave machines.
Ant configuration which I was using –
<target name="setClassPath">
<path id="classpath_jars">
<fileset dir="${lib.dir}" includes="*.jar"/>
</path>
<pathconvert pathsep=":" property="test.classpath"
refid="classpath_jars" />
</target>
<target name="launch-hub" description="Launch Selenium Hub" depends="setClassPath">
<java classname="com.thoughtworks.selenium.grid.hub.HubServer"
classpathref="classpath_jars"
fork="true"
failonerror="true">
<sysproperty key="http.proxyHost" value="${http.proxyHost}" />
<sysproperty key="http.proxyPort" value="${http.proxyPort}" />
<sysproperty key="https.proxyHost" value="${https.proxyHost}" />
<sysproperty key="https.proxyPort" value="${https.proxyPort}" />
</java>
</target>
Now while using this configuration, my hub always starts with “yml” file which is available in “selenium-grid-hub-standalone-1.0.8.jar” instead of considering the “yml” file which I defined on my project root.
Following this I changed the ant configuration as following, which is available in Selenium Grid distribution –
<path id="hub.classpath">
<pathelement path="${basedir}/"/>
<fileset dir="${basedir}/lib">
<include name="selenium-grid-hub-standalone-1.0.8.jar"/>
</fileset>
</path>
<target name="launch-hub" description="Launch Selenium Hub">
<java classname="com.thoughtworks.selenium.grid.hub.HubServer"
classpathref="hub.classpath"
fork="true"
failonerror="true" >
<sysproperty key="http.proxyHost" value="${http.proxyHost}"/>
<sysproperty key="http.proxyPort" value="${http.proxyPort}"/>
<sysproperty key="https.proxyHost" value="${https.proxyHost}"/>
<sysproperty key="https.proxyPort" value="${https.proxyPort}"/>
</java>
</target>
And now when I start the hub, it consider the “yml” file which is defined in my project root and not the one which is available in “selenium-grid-hub-standalone-1.0.8.jar” file.
I am no ant aficionado but I find both configuration almost similar, wherein first configuration has dependency on target while other uses the “pathid”. Any one who could throw light on this?
I think the difference is that the classpath in the second example includes your project root dir:
whereas the first one does not.