使用Arquillian Drone和Selenium Grid

时间:2015-07-04 21:48:18

标签: selenium functional-testing selenium-grid jboss-arquillian arquillian-drone

我使用Arquillian Done为我的基于Web的应用程序创建了一套功能UI测试,我想在Selenium Grid上运行而不是在本地运行它们。

我遇到的问题是,尽管在arquillian.xml文件中设置了Selenium中心服务器的主机/端口详细信息,但UI测试是在本地而不是在其中一个Selenium节点上执行的。我甚至尝试输入不存在的主机的详细信息,但测试仍然在本地运行,并且没有生成错误消息。似乎Drone忽略了arquillian.xml文件中的配置。

arquillian.xml文件中的配置是否有问题,或者我还有其他错误吗?不幸的是,似乎很少有关于使用Arquillian Drone和Selenium Grid的文档。

arquillian.xml文件的内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.org/schema/arquillian"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

  <extension qualifier="webdriver">
    <property name="browser">${arquillian.browser}</property>
    <property name="remoteAddress">http://selenium-hub:4444</property>
  </extension>

   <extension qualifier="selenium-server">
     <property name="host">selenium-hub</property>
     <property name="port">4444</property>
     <property name="skip">true</property>
   </extension>

  <container qualifier="arquillian-glassfish-remote">
    <configuration>
      ...
    </configuration>
  </container>

</arquillian>

My Maven pom.xml文件包含以下依赖项和dependencyManagement部分:

<dependencies>
  <!-- Various Java EE and Internal Dependencies -->

  <!-- Test Dependencies -->
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.jboss.arquillian.junit</groupId>
    <artifactId>arquillian-junit-container</artifactId>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.jboss.arquillian.graphene</groupId>
    <artifactId>graphene-webdriver</artifactId>
    <version>2.0.3.Final</version>
    <type>pom</type>
    <scope>test</scope>
  </dependency>
</dependencies>

<dependencyManagement>
  <dependencies>
    <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>1.1.8.Final</version>
        <scope>import</scope>
        <type>pom</type>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.selenium</groupId>
      <artifactId>selenium-bom</artifactId>
      <version>2.46.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.extension</groupId>
      <artifactId>arquillian-drone-bom</artifactId>
      <version>1.3.1.Final</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

1 个答案:

答案 0 :(得分:3)

似乎有两个问题阻止Arquillian Drone测试针对Selenium Grid执行。

第一个问题是webdriver文件的arquillian.xml部分除<property name="remote">true</property>属性外还需要包含<property name="remoteReusable">true</property>remoteAddress。如果没有remoteremoteReusable,则测试将在本地运行。

第二个问题是remoteAddress未包含Selenium Grid中心服务器的完整URL。该属性应设置为<property name="remoteAddress">http://selenium-hub:4444/wd/hub</property>。显然selenium-hub需要设置为Selenium中心服务器的主机名。我通过浏览器访问此URL后返回NullPointerException,但这似乎是正常行为,因为在正确访问URL时设置了其他参数。

此外,selenium-server文件的arquillian.xml部分似乎是不必要的。

相关问题