Ale*_*hko 1 webdriver jboss-arquillian
我试图使用的Arquillian无人机驾驶员我的测试,但是,出于某种原因注释@Before,@After,@BeforeClass并且@AfterClass被完全忽略.
我是Java/jUnit/Arquillian环境的新手(一直使用Python),所以我可能会在这里犯一些愚蠢的错误.
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import com.eyereturn.warlock.client.pages.login.LoginPage;
@RunWith(Arquillian.class)
public class TestDroneLogin {
@Drone
private WebDriver driver;
@Before
public void setup(){
driver.navigate().to("http://google.com");
}
@Test
public void testInput(){
driver.findElement(By.cssSelector("input#gbqfq"));
}
}
Run Code Online (Sandbox Code Playgroud)
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="browserCapabilities">chrome</property>
</extension>
</arquillian>
Run Code Online (Sandbox Code Playgroud)
pom.xml中:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproj</groupId>
<artifactId>proj-integration-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Project Integration Tests</name>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.31.0</version>
</dependency>
<!-- Arquillian Core dependencies -->
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.0.3.Final</version>
<scope>compile</scope>
<type>pom</type>
</dependency>
<!-- Arquillian Drone dependencies and Selenium dependencies -->
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-bom</artifactId>
<type>pom</type>
<version>1.1.1.Final</version>
<scope>compile</scope>
</dependency>
<!-- Arquillian Graphene Webdriver -->
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>graphene-webdriver</artifactId>
<version>2.0.0.Alpha3</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<!-- Arquillian JUnit Standalone -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-standalone</artifactId>
<version>1.0.3.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
看起来这是Arquillian Standalone版本的持续问题.
这个错误在这里开放,但自2012年8月14日以来没有得到任何关注.
解决方法是使用"Arquillian JUnit Container"版本pom.xml代替"Arquillian JUnit Standalone":
<!-- Arquillian JUnit Container -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.0.3.Final</version>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这似乎对我有用.
注意:使用@BeforeClass时Drone注意这个错误
| 归档时间: |
|
| 查看次数: |
788 次 |
| 最近记录: |