2011-06-24 90 views
0

我试图设置Selenium Grid,而不是使用Selenium Grid下载的ant配置,我继续使用我的ant配置。指定个别jar的类路径

对于不知道Selenium Gird的ant用户,它是一个java lib,可以让UI测试分布在一个“yml”文件中指定的不同系统上。在这里,我可以启动一个中心机器,然后可以在不同的从机器上控制浏览器。

我用它Ant配置 -

<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> 

现在在使用这个配置,我中心始终以“阳明”文件,该文件是在“可用的启动硒电网枢纽独立-1.0.8。 jar“而不是考虑我在我的项目根目录上定义的”yml“文件。

在此之后,我改变了蚂蚁的配置如下,这是硒电网配电可用 -

<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> 

,现在当我开始枢纽,它认为这是在我的项目中定义的“阳明”文件而不是在“selenium-grid-hub-standalone-1.0.8.jar”文件中可用的。

我不是ant爱好者,但我发现两个配置几乎相似,其中第一个配置依赖于目标,而其他使用“pathid”。任何人都可以抛出这个光?

回答

0

我觉得不同的是,在第二个例子中的类路径中包含你的项目的根目录:

<pathelement path="${basedir}/"/> 

,而第一个没有。

+0

实际上,属性lib.dir被定义为 - 因此它引用了basedir,我可以发布整个构建,但这会使它looooong后 – Tarun

+0

但在第一个例子中'$ {basedir}'本身不在classpath中,对吗?如果我了解你,这是你想使用的yml文件的目录。 – sudocode

+0

猜猜看 - 你是天才:-),我在这长长的头脑里窃听着我...... – Tarun