what is good configuration of arquillian-drone-graphene functional testing?

420 views Asked by At

I could not find a good configuration for JEE7 web application functional testing using arquillian-drone-graphene. Note: I can run CDI and EJB tests in Arquillian test suite; they work fine. My POM.xml is as follows:


<properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version.arquillian_core>1.1.8.Final</version.arquillian_core>
        <version.arquillian_drone>1.3.1.Final</version.arquillian_drone>
        <version.graphine_webdriver>2.0.3.Final</version.graphine_webdriver>
        <version.junit>4.12</version.junit>
        <version.selenium_bom>2.45.0</version.selenium_bom>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>${version.arquillian_core}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.extension</groupId>
                <artifactId>arquillian-drone-bom</artifactId>
                <version>${version.arquillian_drone}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.selenium</groupId>
                <artifactId>selenium-bom</artifactId>
                <version>${version.selenium_bom}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.graphene</groupId>
                <artifactId>graphene-webdriver</artifactId>
                <version>${version.graphine_webdriver}</version>
                <type>pom</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian.graphene</groupId>
                <artifactId>arquillian-graphene</artifactId>
                <version>${version.graphine_webdriver}</version>
                <type>pom</type>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>5.1</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>primefaces-extensions</artifactId>
            <version>3.0.0</version>
        </dependency>
        <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.graphene</groupId>
            <artifactId>graphene-webdriver</artifactId>
            <type>pom</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.graphene</groupId>
            <artifactId>graphene-webdriver-impl</artifactId>
            <version>${version.graphine_webdriver}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>arquillian-wildfly-embedded</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.14.1</version>
                        <configuration>
                            <forkMode>always</forkMode>
                            <systemPropertyVariables>
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                                <jboss.home>${jboss.home}</jboss.home>
                                <module.path>${jboss.home}/modules</module.path>
                            </systemPropertyVariables>
                            <redirectTestOutputToFile>false</redirectTestOutputToFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <jboss.home>/home/wildfly-8.2.0.Test</jboss.home>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-arquillian-container-embedded</artifactId>
                    <version>8.2.0.Final</version>
                    <scope>test</scope>
                </dependency>
                 <dependency>
     <groupId>org.wildfly</groupId>
     <artifactId>wildfly-embedded</artifactId>
     <version>8.2.0.Final</version>
   </dependency>
            </dependencies>
        </profile>

</profiles>

and my arquillian.xml is as follows:

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">
  <defaultProtocol type="Servlet 3.0"/>
  <extension qualifier="webdriver">
    <property name="browser">firefox</property>
    <property name="loggingPrefs">driver=INFO,profiler=WARNING</property>
  </extension>
  <container qualifier="arquillian-wildfly-embedded">

  </container>

</arquillian>

Could anybody suggest me a good configuration for wildfly-8.2.0.Final + arquillian + Drone + Graphene functional testing POM ?

NOTE: with above configuration, my functional tests always end with following error trace:

    testEjb_should_persist_drone(com.syntech.test.ArquillianDroneTest)  Time elapsed: 0.391 sec  <<< ERROR!
java.lang.RuntimeException: org/apache/http/conn/SchemePortResolver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:99)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:154)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createRemoteDriver(RemoteWebDriverFactory.java:150)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createReusableDriver(RemoteWebDriverFactory.java:178)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createInstance(RemoteWebDriverFactory.java:98)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createInstance(RemoteWebDriverFactory.java:49)
    at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:130)
    at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:41)
    at org.jboss.arquillian.drone.impl.DroneCallableCreator$1.call(DroneCallableCreator.java:89)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.jboss.arquillian.drone.impl.DroneExecutorService$ContextualRunnable.run(DroneExecutorService.java:113)
    at java.lang.Thread.run(Thread.java:745)

testEjb_should_persist_embedded_drone(com.syntech.test.ArquillianDroneTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.RuntimeException: org/apache/http/conn/SchemePortResolver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:99)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:154)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createRemoteDriver(RemoteWebDriverFactory.java:150)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createReusableDriver(RemoteWebDriverFactory.java:178)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createInstance(RemoteWebDriverFactory.java:98)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createInstance(RemoteWebDriverFactory.java:49)
    at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:130)
    at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:41)
    at org.jboss.arquillian.drone.impl.DroneCallableCreator$1.call(DroneCallableCreator.java:89)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.jboss.arquillian.drone.impl.DroneExecutorService$ContextualRunnable.run(DroneExecutorService.java:113)
    at java.lang.Thread.run(Thread.java:745)

serviceFacade_should_be_deployed_drone(com.syntech.test.ArquillianDroneTest)  Time elapsed: 0.012 sec  <<< ERROR!
java.lang.RuntimeException: org/apache/http/conn/SchemePortResolver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:99)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:154)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createRemoteDriver(RemoteWebDriverFactory.java:150)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createReusableDriver(RemoteWebDriverFactory.java:178)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createInstance(RemoteWebDriverFactory.java:98)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createInstance(RemoteWebDriverFactory.java:49)
    at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:130)
    at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:41)
    at org.jboss.arquillian.drone.impl.DroneCallableCreator$1.call(DroneCallableCreator.java:89)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.jboss.arquillian.drone.impl.DroneExecutorService$ContextualRunnable.run(DroneExecutorService.java:113)
    at java.lang.Thread.run(Thread.java:745)

testUserLoginSuccess(com.syntech.test.ArquillianDroneTest)  Time elapsed: 0.027 sec  <<< ERROR!
java.lang.RuntimeException: org/apache/http/conn/SchemePortResolver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:99)
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:154)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createRemoteDriver(RemoteWebDriverFactory.java:150)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createReusableDriver(RemoteWebDriverFactory.java:178)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createInstance(RemoteWebDriverFactory.java:98)
    at org.jboss.arquillian.drone.webdriver.factory.RemoteWebDriverFactory.createInstance(RemoteWebDriverFactory.java:49)
    at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:130)
    at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:41)
    at org.jboss.arquillian.drone.impl.DroneCallableCreator$1.call(DroneCallableCreator.java:89)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.jboss.arquillian.drone.impl.DroneExecutorService$ContextualRunnable.run(DroneExecutorService.java:113)
    at java.lang.Thread.run(Thread.java:745)

com.syntech.test.ArquillianDroneTest  Time elapsed: 0.375 sec  <<< ERROR!
java.lang.IllegalStateException: Unexpected callable present in Drone Context, should be already instantiated at this moment.
    at org.jboss.arquillian.drone.impl.InstanceOrCallableInstanceImpl.asInstance(InstanceOrCallableInstanceImpl.java:57)
    at org.jboss.arquillian.drone.impl.DroneEnhancer.deenhanceDrone(DroneEnhancer.java:119)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
    at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
    at org.jboss.arquillian.drone.impl.DroneDestructor.destroyClassScopedDrone(DroneDestructor.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
    at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
    at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.afterClass(EventTestRunnerAdaptor.java:94)
    at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:223)
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:422)
    at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)
    at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:218)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:166)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:159)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:87)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)

INFO  [org.jboss.as.connector.subsystems.datasources] JBAS010409: Unbound data source [java:jboss/datasources/ExampleDS]
INFO  [org.wildfly.extension.undertow] JBAS017532: Host default-host stopping
INFO  [org.wildfly.extension.undertow] JBAS017521: Undertow HTTP listener default suspending
INFO  [org.jboss.as.connector.deployers.jdbc] JBAS010418: Stopped Driver service with driver-name = h2
INFO  [com.arjuna.ats.jbossatx] ARJUNA032018: Destroying TransactionManagerService
INFO  [com.arjuna.ats.jbossatx] ARJUNA032014: Stopping transaction recovery manager
INFO  [org.wildfly.extension.undertow] JBAS017520: Undertow HTTP listener default stopped, was bound to /127.0.0.1:8080
INFO  [org.wildfly.extension.undertow] JBAS017506: Undertow 1.1.0.Final stopping
INFO  [org.jboss.as] JBAS015950: WildFly 8.2.0.Final "Tweek" stopped in 136ms

Results :

Tests in error: 
   » Runtime org/apache/http/conn/SchemePortResolver
   » Runtime org/apache/http/conn/SchemePortResolver
   » Runtime org/apache/http/conn/SchemePortResolver
   » Runtime org/apache/http/conn/SchemePortResolver
   » IllegalState Unexpected callable present in Drone Context, should be alread...

Tests run: 10, Failures: 0, Errors: 5, Skipped: 0
2

There are 2 answers

0
yayayokoho3 On

Finally I am done with the help of this link. That was the configuration I was looking for so desperately.

0
vins On

I too had many difficulties in setting up the arquillian framework. Once done, it was so easy to use.

Please check here for more info: http://www.testautomationguru.com/selenium-webdriver-automation-using-arquillian-framework/