Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从Ant构建运行Selenium 2网格?_Ant_Selenium Webdriver_Selenium Grid - Fatal编程技术网

如何从Ant构建运行Selenium 2网格?

如何从Ant构建运行Selenium 2网格?,ant,selenium-webdriver,selenium-grid,Ant,Selenium Webdriver,Selenium Grid,我正在修改我们现有的Selenium网格设置,以便它可以与Selenium 2一起使用。设置集线器和节点的过程似乎要简单得多,但在Ant构建中运行集线器和节点时,我遇到了一个问题,就像我以前做的那样 我已经通读了Selenium 2网格,并尝试相应地设置Ant构建。我的问题是第一个目标运行,启动集线器。然后,其他目标不运行,但构建完成。我正试图在自己的机器上运行这些测试,使用Selenium1(RC)Junit测试,并将TestNG作为测试运行程序 我的目标如下: <taskdef res

我正在修改我们现有的Selenium网格设置,以便它可以与Selenium 2一起使用。设置集线器和节点的过程似乎要简单得多,但在Ant构建中运行集线器和节点时,我遇到了一个问题,就像我以前做的那样

我已经通读了Selenium 2网格,并尝试相应地设置Ant构建。我的问题是第一个目标运行,启动集线器。然后,其他目标不运行,但构建完成。我正试图在自己的机器上运行这些测试,使用Selenium1(RC)Junit测试,并将TestNG作为测试运行程序

我的目标如下:

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

看起来Ant线程在第一个目标运行之后就完成了。我研究了一种在新窗口中启动它们的方法,就像以前的网格一样,但除了
exec
任务之外,我没有找到其他方法。我还尝试在
exec
任务中运行hub,并将节点作为
java
任务运行。这导致ant构建在
start hub
目标之后停止执行,而不是完成


有什么方法可以让它运行,或者有更好的方法来完成它吗?

请看一下Mozilla团队的工作方式:

注意,他们仍然使用Grid1节点启动器,因为Grid2在这方面是向后兼容的。但它应该让您了解如何在ant中处理此问题