1

Arquillian Droneを使用してテストを実行しようとしていますが何らかの理由でアノテーション、、、@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"));
    }
}

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>
4

1 に答える 1

5

これは、 ArquillianStandaloneバージョンで進行中の問題のようです。

バグはここで公開されていますが、2012年8月14日以降注目されていません

回避策は、 「ArquillianJUnitStandalone」の代わりに「ArquillianJUnitContainer バージョンを使用することです。pom.xml

    <!-- 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

于 2013-03-06T16:17:35.330 に答える