不能使用Arquillian石墨烯与Arquillian无人机

时间:2015-01-29 12:56:12

标签: java selenium selenium-webdriver jboss-arquillian arquillian-drone

我正在使用Arquillian 1.1.6.Final来使用JSF来测试Arquillian Drone 2.0.0.Alpha3。它很棒。但是当我使用Arquillian Graphene 2.1.0.Alpha1进一步添加该功能时,会有一个例外

java.lang.NullPointerException
at org.jboss.arquillian.graphene.enricher.WebElementEnricher.enrich(WebElementEnricher.java:68)
at org.jboss.arquillian.graphene.enricher.GrapheneEnricher.enrich(GrapheneEnricher.java:55)
at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:52)

即使我将Arquillian Graphene恢复为版本2.0.3.Final,仍会抛出异常。这是我的pom.xml

<properties>
    <my.arquillian.drone.version>2.0.0.Alpha3</my.arquillian.drone.version>
    <my.arquillian.version>1.1.6.Final</my.arquillian.version>
    <!--my.arquillian.graphene.version>2.1.0.Alpha1</my.arquillian.graphene.version-->
    <my.arquillian.graphene.version>2.0.3.Final</my.arquillian.graphene.version>
    <my.arquillian.recorder.version>1.0.0.Beta1</my.arquillian.recorder.version>
    <my.arquillian.selenium.version>2.44.0</my.arquillian.selenium.version>
</properties>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>${my.arquillian.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.selenium</groupId>
            <artifactId>selenium-bom</artifactId>
            <version>${my.arquillian.selenium.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
            <dependency>
                  <groupId>org.jboss.arquillian.extension</groupId>
                  <artifactId>arquillian-drone-bom</artifactId>
                  <version>${my.arquillian.drone.version}</version>
            <type>pom</type>
            <scope>import</scope>
            </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-webdriver-depchain</artifactId>
        <type>pom</type>
        <scope>test</scope>
    </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.graphene</groupId>
            <artifactId>graphene-webdriver</artifactId>
            <version>${my.arquillian.graphene.version}</version>
            <type>pom</type>
      <scope>test</scope>
        </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <scope>${my.project.dependency.test.scope}</scope>
        <exclusions>
            <exclusion>
                <artifactId>servlet-api-2.5</artifactId>
                <groupId>org.mortbay.jetty</groupId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

我的单元测试是

@RunWith(Arquillian.class)
public class DroneTest {

    @Drone
    private WebDriver browser;

    @Test
    @RunAsClient
    public void ensureIndexPage() {
        try{
            browser.get("http://www.google.com")
        } catch (Exception e){
            e.printStackTrace(); //<---- Exception in thrown here
        }
    }

}

如上所述,单元测试在没有Arquillian Graphene的情况下正常工作。你能帮忙进一步提出建议吗?

1 个答案:

答案 0 :(得分:0)

我正在寻找能够与Arquillian Suite Extensionrhq-arquillian-suite-extensionArquillian 1.1.6.Final一起使用的Arquillian Drone 2.0.0.Alpha3而不是Arquillian Graphene 2.1.0.Alpha1。我发现ingwarsw/arquillian-suite-extension它适用于所有人。

无论如何有一些限制,这是一个已知问题,它无法与Arquillian Warp issue-16一起使用。

如果我们希望在没有code coverage的情况下实现Arquillian WarpJacoco可能会有帮助,如JBoss Developer Forum: How to generate Code Coverage reports from Drone tests所述。