<!--Tests-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</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.extension</groupId>
<artifactId>arquillian-drone-webdriver-depchain</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-embedded</artifactId>
<version>8.1.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-angularjs-graphene</artifactId>
<version>1.2.0.Alpha1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<version>${version.shrinkwrap.resolvers}</version>
<scope>test</scope>
<type>pom</type>
</dependency>
我将测试web存档打包如下:
public class Deployments {
public static Archive createDeployment() {
return ShrinkWrap.create(MavenImporter.class)
.loadPomFromFile("/Users/alekspo/Documents/Development/Java/WildFly/sp/pom.xml")
.importBuildOutput().as(WebArchive.class);
}
}
你知道我为什么会犯这样的错误吗?
我今天也遇到了同样的问题。绝对不是依赖问题。堆栈跟踪已经暗示Arquillian试图在服务器本身运行Drone测试,而不是充当客户机。这首先是奇怪的,因为我们实际上想作为客户机运行它。在Arquillian的《使用无人机和石墨烯的功能测试指南》中描述了如何做到这一点:
如何激活客户端模式?很简单。您可以将部署标记为不可测试,这意味着Arquillian不会丰富归档,或者可以使用注释@runasclient
标记指定的方法。
换句话说,你需要
@RunWith(Arquillian.class)
public class Test {
@Deployment(testable = false)
public static Archive<?> createDeployment() {
// ...
}
@Test
public void test() {
// ...
}
}
@RunWith(Arquillian.class)
public class Test {
@Deployment
public static Archive<?> createDeployment() {
// ...
}
@Test
@RunAsClient
public void test() {
// ...
}
}