如何从一个Ant构建运行Selenium 2格? [英] How can I run Selenium 2 Grid from an Ant build?

查看:310
本文介绍了如何从一个Ant构建运行Selenium 2格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在努力改变我们现有的硒网格设置,使其与硒2.建立枢纽和节点的过程似乎要简单得多的工作,但我有得到它在运行的问题Ant构建我之前的方式。

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.

我已经通过维基硒2阅读网并试图建立相应Ant构建。我的问题是,第一目标运行时,启动中心。然后,其他的目标不运行,但构建完成。我试图以我自己的机器上运行这些,与硒1(RC)JUnit测试和TestNG作为测试运行。

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.

我的目标如下:

<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的线程完成。我看着一个方法在新窗口中启动它们,像previous格,但我没有看到一个办法做到这一点除了 EXEC 任务。我也试过在 EXEC 任务和节点作为的Java 任务运行的枢纽。这导致在启动中心目标,而不是办完Ant构建停止执行。

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?

推荐答案

看看Mozilla的团队确实在这里的方式:

Take a look at the way the Mozilla team does it here:

https://github.com/mozilla/moz-grid-config

请注意,他们仍然使用网格1个节点发射,因为格2在这方面是向后兼容的。但它应该给你如何在蚂蚁处理这一个想法。

Note that they're still using the Grid 1 node launchers, since Grid 2 is backwards-compatible in that respect. But it should give you an idea of how to handle this in ant.

这篇关于如何从一个Ant构建运行Selenium 2格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆