5 Replies Latest reply on Nov 10, 2017 9:03 AM by razal-lister

    Suite of arquillian tests does not pass. Individual tests do. Why?

    hpgisler

      Hi

       

      I have got multiple arquillian test classes which I try to get run in sequence (defined within a testng.xml) via maven surefire.

       

      If I test the classes individually like so:

       

      {code}mvn -Dtest=com.example.ArquillianBasicWebArchiveTest -Pglassfish-remote-3.1 test-compile surefire:test{code}

      it works (the test gets executed correctly on glassfish-remote and passes).

       

      However, if I try to test all the classes in the test-suite like so:

       

      {code}mvn -Pglassfish-remote-3.1 test-compile surefire:test{code}

      I get this error:

       

      {code}loggerInjectionTest(com.example.ArquillianBasicWebArchiveTest): No TestRunnerAdaptor found, @BeforeSuite has not been called{code}

       

      Any ideas what I am doing wrong? (I am using the maven profile 'glassfish-remote-3.1' to activate arquillian glassfish-remote environment as described in the arquillian docu).

       

      Thanks very much for any ideas.

      Hanspeter

        • 1. Re: Suite of arquillian tests does not pass. Individual tests do. Why?
          aslak

          Do you have the stack trace to that exception? It can be thrown from multiple locations..

          • 2. Re: Suite of arquillian tests does not pass. Individual tests do. Why?
            hpgisler

            Hi Aslak, sorry, I totally forgot - and thanks for your fast reply.

             

            Here is the stack trace:

             

            {code}

            loggerInjectionTest(com.example.ArquillianBasicEnterpriseArchiveTest)  Time elapsed: 0.006 sec  <<< FAILURE!

            java.lang.IllegalStateException: No TestRunnerAdaptor found, @BeforeSuite has not been called

                      at org.jboss.arquillian.testng.Arquillian.verifyTestRunnerAdaptorHasBeenSet(Arquillian.java:246)

                      at org.jboss.arquillian.testng.Arquillian.run(Arquillian.java:154)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                      at java.lang.reflect.Method.invoke(Method.java:601)

                      at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:191)

                      at org.testng.internal.Invoker.invokeMethod(Invoker.java:666)

                      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)

                      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)

                      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

                      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

                      at org.testng.TestRunner.runWorkers(TestRunner.java:1147)

                      at org.testng.TestRunner.privateRun(TestRunner.java:749)

                      at org.testng.TestRunner.run(TestRunner.java:600)

                      at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)

                      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)

                      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)

                      at org.testng.SuiteRunner.run(SuiteRunner.java:223)

                      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

                      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

                      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039)

                      at org.testng.TestNG.runSuitesLocally(TestNG.java:964)

                      at org.testng.TestNG.run(TestNG.java:900)

                      at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:122)

                      at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)

                      at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:105)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                      at java.lang.reflect.Method.invoke(Method.java:601)

                      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:188)

                      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:166)

                      at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)

                      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:101)

                      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)

            {code}

             

            • 3. Re: Suite of arquillian tests does not pass. Individual tests do. Why?
              john.genoese

              Are you perchance using the Groups facility?

               

              If so, you need to know that the Arquillian superclass we use for TestNG contains the @BeforeSuite(groups="arquillian") annotation. This means that you must either include the group "arquillian" in any "groups" list (i.e. Maven <groups> ), or ensure that it is omitted from any "excludeGroups" list (i.e. Maven <excludeGroups>).

               

              Here's an set of examples that illustrates what I mean:

               

               

                  <profiles>

                      <profile>

                          <id>Integration</id>

                          <build>

                              <plugins>

                                  <plugin>

                                      <groupId>org.apache.maven.plugins</groupId>

                                      <artifactId>maven-surefire-plugin</artifactId>

                                      <executions>

                                          <execution>

                                              <id>default-test</id>

                                              <configuration>

                                                  <groups>arquillian, Integration</groups>

                                                  <reportsDirectory>target/integration-surefire-reports/</reportsDirectory>

                                              </configuration>

                                          </execution>

                                      </executions>

                                  </plugin>

                              </plugins>

                          </build>

                      </profile>

                      <profile>

                          <id>Unit</id>

                          <build>

                              <plugins>

                                  <plugin>

                                      <groupId>org.apache.maven.plugins</groupId>

                                      <artifactId>maven-surefire-plugin</artifactId>

                                      <executions>

                                          <execution>

                                              <id>default-test</id>

                                              <configuration>

                                                  <groups>Unit</groups>

                                                  <reportsDirectory>target/surefire-reports/</reportsDirectory>

                                              </configuration>

                                          </execution>

                                      </executions>

                                  </plugin>

                              </plugins>

                          </build>

                      </profile>

                      <profile>

                          <id>All</id>

                          <build>

                              <plugins>

                                  <plugin>

                                      <groupId>org.apache.maven.plugins</groupId>

                                      <artifactId>maven-surefire-plugin</artifactId>

                                      <executions>

                                          <execution>

                                              <id>default-test</id>

                                              <configuration>

                                                  <groups>Unit, arquillian, Integration</groups>

                                                  <reportsDirectory>target/surefire-reports/</reportsDirectory>

                                              </configuration>

                                          </execution>

                                      </executions>

                                  </plugin>

                              </plugins>

                          </build>

                      </profile>

                  </profiles>

               


               

              • 4. Re: Suite of arquillian tests does not pass. Individual tests do. Why?
                sathiyaseelan

                Hi I have the same problem..It works when i added "arquillian" into my group list

                thks John

                • 5. Re: Suite of arquillian tests does not pass. Individual tests do. Why?
                  razal-lister

                  I have two group in the test class.

                  1. data-dependent

                  2. data-not-dependent

                   

                  I was getting this error message "Error : java.lang.IllegalStateException: No TestRunnerAdaptor found, @BeforeSuite has not been called" and later adding arquillian in maven groups solved above errors.

                   

                  It is executing all groups test instead of which I specified in maven group tag.

                   

                  <groups>data-dependent,arquillian</groups>

                   

                  TestClass has 4 test method out of which 2 belongs to data-dependent and other to belongs to data-not-dependent test.

                   

                  When I tried to run suite, it was executing all four methods instead of two method which belongs to data-dependent group