2013-03-06 4 views
1

Я пытаюсь использовать Arquillian Drone водитель моих тесты, однако, по какой-то причине аннотаций @Before, @After, @BeforeClass и @AfterClass полностью игнорируются.Arquillian Drone полностью игнорирует До После 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")); 
    } 
} 

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> 

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> 

ответ

5

Похоже, это постоянная проблема с Arquillian Standalone версии.

ошибка открыта here, , но не обратила на это никакого внимания с 14 августа 2012 г..

Для устранения этой проблемы использовать "Arquillian JUnit Контейнер" версию в 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> 

Это похоже на работу для меня.

ПРИМЕЧАНИЕ: При использовании @BeforeClass с Drone следить за this bug

Смежные вопросы