我正在使用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
的情况下正常工作。你能帮忙进一步提出建议吗?
答案 0 :(得分:0)
我正在寻找能够与Arquillian Suite Extension
,rhq-arquillian-suite-extension
和Arquillian 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 Warp
,Jacoco
可能会有帮助,如JBoss Developer Forum: How to generate Code Coverage reports from Drone tests所述。