2 Replies Latest reply on May 29, 2013 1:12 PM by Lukáš Fryč

    Tests with Arquillian (standalone) in TestNG are called twice

    Michal Vanco Newbie

      Hi guys,

       

      I'm currently using Arquillian (testng standalone) + Graphene at one of my POC projects and I hit some issues:

       

      1) TestNG tests are executed twice

      - see the attached simplest maven project which reproduce the issue (run with mvn clean install -Pselenium or from your IDE as TestNG test)

       

      There is nothing else than just:

       

       

      public class LoginPageTest extends AbstractTest {
      
       @Test
                public void test1() {
                          System.out.println("Running test1");
                }
      }
      

      and

       

      public abstract class AbstractTest extends Arquillian {
      
       @Drone
                protected WebDriver browser;
        
       @BeforeMethod
                public void loadPlatformPageBeforeTestMethod() {
                          browser.manage().deleteAllCookies();
                          String pageURL = "https://google.com";
                          browser.get(pageURL);
                }
      }
      

      When you run the test, you get an output like:

       

      Loading page... https://google.com

      Running test1

      Running test1

       

      2) Arquillian TestNG standalone doesn't work without a dependency on Arq. JUnit standlone :/

      I spent a really looong time to get the minimal project running (arquillian testng standalone + drone/graphene)

       

      - you can reproduce this on attached project as well, just remove a dependency on

      <groupId>org.jboss.arquillian.junit</groupId>

      <artifactId>arquillian-junit-standalone</artifactId>


      and you will get an exception when trying to run the test:

       

      java.lang.RuntimeException: Could not load class org.jboss.arquillian.core.impl.loadable.LoadableExtensionLoader

       

      - maybe there's a chance that it cause a weird behavior described in 1)

       

      I would really appreciate your help, I have already a bigger POC where I'm using the Graphene (with fragments and all the utility stuff from Graphene class) and I would really like to continue, but these issues kinda blocks me atm.

       

      Best regards,

      Michal

        • 1. Re: Tests with Arquillian (standalone) in TestNG are called twice
          Michal Vanco Newbie

          Hmmmmm.... I just solved the problem, looks like dependencies are broken a bit broken for standalone testng arquillian

           

          When I run the dependency:tree, I get an output:

           

          [INFO] com.test:testng-test:jar:1.0-SNAPSHOT

          [INFO] +- org.testng:testng:jar:6.8.5:test

          [INFO] |  +- junit:junit:jar:4.10:test

          [INFO] |  |  \- org.hamcrest:hamcrest-core:jar:1.1:test

          [INFO] |  +- org.beanshell:bsh:jar:2.0b4:test

          [INFO] |  +- com.beust:jcommander:jar:1.27:test

          [INFO] |  \- org.yaml:snakeyaml:jar:1.6:test

          [INFO] +- org.jboss.arquillian.testng:arquillian-testng-standalone:jar:1.0.3.Final:test

          [INFO] |  +- org.jboss.arquillian.testng:arquillian-testng-core:jar:1.0.3.Final:test

          [INFO] |  +- org.jboss.arquillian.test:arquillian-test-spi:jar:1.0.3.Final:test

          [INFO] |  |  +- org.jboss.arquillian.core:arquillian-core-spi:jar:1.0.3.Final:test

          [INFO] |  |  \- org.jboss.arquillian.test:arquillian-test-api:jar:1.0.3.Final:test

          [INFO] |  \- org.jboss.arquillian.config:arquillian-config-impl-base:jar:1.0.3.Final:test

          [INFO] |     +- org.jboss.arquillian.config:arquillian-config-api:jar:1.0.3.Final:test

          [INFO] |     |  \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-api-base:jar:2.0.0-alpha-3:test

          [INFO] |     +- org.jboss.arquillian.core:arquillian-core-api:jar:1.0.3.Final:test

          [INFO] |     \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-spi:jar:2.0.0-alpha-3:test

          [INFO] +- org.jboss.arquillian.junit:arquillian-junit-standalone:jar:1.0.3.Final:test

          [INFO] |  +- org.jboss.arquillian.junit:arquillian-junit-core:jar:1.0.3.Final:test

          [INFO] |  +- org.jboss.arquillian.core:arquillian-core-impl-base:jar:1.0.3.Final:test

          [INFO] |  \- org.jboss.arquillian.test:arquillian-test-impl-base:jar:1.0.3.Final:test

          [INFO] \- org.jboss.arquillian.graphene:arquillian-graphene:pom:2.0.0.Alpha4:test

          [INFO]    +- org.jboss.arquillian.graphene:graphene-selenium:pom:2.0.0.Alpha4:test

          [INFO]    |  +- org.jboss.arquillian.graphene:graphene-selenium-impl:jar:2.0.0.Alpha4:test

          [INFO]    |  |  +- org.jboss.arquillian.graphene:graphene-selenium-api:jar:2.0.0.Alpha4:test

          [INFO]    |  |  \- org.apache.commons:commons-lang3:jar:3.1:test

          [INFO]    |  +- org.jboss.arquillian.graphene:graphene-selenium-drone:jar:2.0.0.Alpha4:test

          [INFO]    |  |  +- org.jboss.arquillian.extension:arquillian-drone-api:jar:1.2.0.Alpha2:test

          [INFO]    |  |  +- org.jboss.arquillian.extension:arquillian-drone-spi:jar:1.2.0.Alpha2:test

          [INFO]    |  |  \- org.jboss.arquillian.extension:arquillian-drone-configuration:jar:1.2.0.Alpha2:test

          [INFO]    |  +- org.jboss.arquillian.extension:arquillian-drone-impl:jar:1.2.0.Alpha2:test

          [INFO]    |  +- org.jboss.arquillian.extension:arquillian-drone-selenium-server:jar:1.2.0.Alpha2:test

          [INFO]    |  \- org.seleniumhq.selenium:selenium-server:jar:2.31.0:test

          [INFO]    |     +- org.bouncycastle:bcprov-jdk15on:jar:1.48:test

          [INFO]    |     +- org.bouncycastle:bcpkix-jdk15on:jar:1.48:test

          [INFO]    |     +- mx4j:mx4j-tools:jar:3.0.1:test

          [INFO]    |     +- org.mortbay.jetty:servlet-api-2.5:jar:6.1.9:test

          [INFO]    |     +- org.seleniumhq.selenium:jetty-repacked:jar:7.6.1:test

          [INFO]    |     +- net.jcip:jcip-annotations:jar:1.0:test

          [INFO]    |     \- commons-codec:commons-codec:jar:1.6:test

          [INFO]    \- org.jboss.arquillian.graphene:graphene-webdriver:pom:2.0.0.Alpha4:test

          [INFO]       +- org.jboss.arquillian.graphene:graphene-webdriver-impl:jar:2.0.0.Alpha4:test

          [INFO]       |  \- org.jboss.arquillian.graphene:graphene-webdriver-spi:jar:2.0.0.Alpha4:test

          [INFO]       +- org.jboss.arquillian.extension:arquillian-drone-webdriver-depchain:pom:1.2.0.Alpha2:test

          [INFO]       |  +- org.jboss.arquillian.extension:arquillian-drone-webdriver:jar:1.2.0.Alpha2:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-api:jar:2.31.0:test

          [INFO]       |  |  +- com.google.guava:guava:jar:14.0:test

          [INFO]       |  |  \- org.json:json:jar:20080701:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-support:jar:2.31.0:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-android-driver:jar:2.31.0:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.31.0:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.31.0:test

          [INFO]       |  |  +- commons-io:commons-io:jar:2.2:test

          [INFO]       |  |  \- org.apache.commons:commons-exec:jar:1.1:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.31.0:test

          [INFO]       |  |  +- net.sourceforge.htmlunit:htmlunit:jar:2.11:test

          [INFO]       |  |  |  +- xalan:xalan:jar:2.7.1:test

          [INFO]       |  |  |  |  \- xalan:serializer:jar:2.7.1:test

          [INFO]       |  |  |  +- commons-collections:commons-collections:jar:3.2.1:test

          [INFO]       |  |  |  +- org.apache.httpcomponents:httpmime:jar:4.2.2:test

          [INFO]       |  |  |  +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.11:test

          [INFO]       |  |  |  +- xerces:xercesImpl:jar:2.10.0:test

          [INFO]       |  |  |  |  \- xml-apis:xml-apis:jar:1.4.01:test

          [INFO]       |  |  |  +- net.sourceforge.nekohtml:nekohtml:jar:1.9.17:test

          [INFO]       |  |  |  +- net.sourceforge.cssparser:cssparser:jar:0.9.8:test

          [INFO]       |  |  |  |  \- org.w3c.css:sac:jar:1.3:test

          [INFO]       |  |  |  +- commons-logging:commons-logging:jar:1.1.1:test

          [INFO]       |  |  |  \- org.eclipse.jetty:jetty-websocket:jar:8.1.7.v20120910:test

          [INFO]       |  |  |     +- org.eclipse.jetty:jetty-util:jar:8.1.7.v20120910:test

          [INFO]       |  |  |     +- org.eclipse.jetty:jetty-io:jar:8.1.7.v20120910:test

          [INFO]       |  |  |     \- org.eclipse.jetty:jetty-http:jar:8.1.7.v20120910:test

          [INFO]       |  |  \- org.apache.httpcomponents:httpclient:jar:4.2.1:test

          [INFO]       |  |     \- org.apache.httpcomponents:httpcore:jar:4.2.1:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-ie-driver:jar:2.31.0:test

          [INFO]       |  |  +- net.java.dev.jna:jna:jar:3.4.0:test

          [INFO]       |  |  \- net.java.dev.jna:platform:jar:3.4.0:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-iphone-driver:jar:2.31.0:test

          [INFO]       |  +- org.seleniumhq.selenium:selenium-remote-driver:jar:2.31.0:test

          [INFO]       |  |  \- cglib:cglib-nodep:jar:2.1_3:test

          [INFO]       |  +- com.opera:operadriver:jar:1.1:test

          [INFO]       |  |  +- com.opera:operalaunchers:jar:1.1:test

          [INFO]       |  |  +- com.google.protobuf:protobuf-java:jar:2.4.1:test

          [INFO]       |  |  +- commons-jxpath:commons-jxpath:jar:1.3:test

          [INFO]       |  |  \- org.ini4j:ini4j:jar:0.5.2:test

          [INFO]       |  \- com.github.detro.ghostdriver:phantomjsdriver:jar:1.0.3:test

          [INFO]       \- org.seleniumhq.selenium:selenium-java:jar:2.31.0:test

          [INFO]          +- org.seleniumhq.selenium:selenium-safari-driver:jar:2.31.0:test

          [INFO]          \- org.webbitserver:webbit:jar:0.4.14:test

          [INFO]             \- io.netty:netty:jar:3.5.2.Final:test

           

          When I removed

           

          <dependency>
                                        <groupId>org.jboss.arquillian.junit</groupId>
                                        <artifactId>arquillian-junit-standalone</artifactId>
                                  <scope>test</scope>
            </dependency>
          
          

           

          and added missing dependencies:

            <dependency>
                                        <groupId>org.jboss.arquillian.core</groupId>
                                        <artifactId>arquillian-core-impl-base</artifactId>
                                        <scope>test</scope>
            </dependency>
          
            <dependency>
                                        <groupId>org.jboss.arquillian.test</groupId>
                                        <artifactId>arquillian-test-impl-base</artifactId>
                                        <scope>test</scope>
            </dependency>
          

           

          it worked as expected - and both issues are solved now (thanks God!!!!).

           

          Please review the dependencies and hopefully it won't be needed at next version

           

          Best regards,

          Michal

          • 2. Re: Tests with Arquillian (standalone) in TestNG are called twice
            Lukáš Fryč Master

            Thanks for reporting Michal.

             

            I believe you hit an ARQ-1287.

             

            We will need to polish Standalone modes in upcoming releases.