10 Replies Latest reply on Feb 8, 2012 7:40 AM by silenius

    Arquillian JBoss AS 7 remote and arquillian-jacoco

    silenius

      Hi all,

       

      I've been unsuccessful trying to run test coverage with arquillian-jacoco and JBoss AS 7.0.2.

       

      Here are the relevants parts of my pom.xml:

       

      <build>
          <plugins>
          [...]
              <plugin>
                  <groupId>org.jacoco</groupId>
                  <artifactId>jacoco-maven-plugin</artifactId>
                  <version>0.5.6.201201232323</version>
                  <executions>
                      <execution>
                          <goals>
                              <goal>prepare-agent</goal>
                          </goals>
                      </execution>
                  </executions>
              </plugin>
          [...]
          </plugins>
      </build>
      
      <dependencyManagement>
          <dependencies>
              <dependency>
                  <groupId>org.jboss.arquillian</groupId>
                  <artifactId>arquillian-bom</artifactId>
                  <version>${arquillian.version}</version>
                  <scope>import</scope>
                  <type>pom</type>
              </dependency>
          </dependencies>
      </dependencyManagement>
      
      <dependencies>
          [...]
          <dependency>
              <groupId>org.jboss.arquillian.protocol</groupId>
              <artifactId>arquillian-protocol-servlet</artifactId>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>org.jboss.arquillian.extension</groupId>
              <artifactId>arquillian-jacoco</artifactId>
              <version>1.0.0.Alpha2</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>org.jacoco</groupId>
              <artifactId>org.jacoco.core</artifactId>
              <version>0.5.6.201201232323</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>org.testng</groupId>
              <artifactId>testng</artifactId>
              <version>6.3.1</version>
              <scope>test</scope>
          </dependency>
          [...]
      </dependencies>
      
      <reporting>
          <plugins>
          [...]
              <plugin>
                  <groupId>org.jacoco</groupId>
                  <artifactId>jacoco-maven-plugin</artifactId>
                  <version>0.5.6.201201232323</version>
              </plugin>
          [...]
          </plugins>
      </reporting>
      

       

      It completely hangs out the server at this line:

      19:43:05,873 INFO  [org.jboss.as.server.controller] (pool-1-thread-5) Deployed "arquillian-service"
      

       

      I would appreciate some help on this please.

       

      Regards,

      Samuel Santos

        • 1. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
          aslak

          You don't need jacoco-maven-plugin prepare-agent for the Arquillian bits.

           

          Try using the Servlet 3.0 protocol instead of the AS7-JMX one, either by using @Deployment @OverProtocol("Servlet 3.0") or <arquillian><defaultProtocol type="Servlet 3.0" />... in arquillian.xml

          • 2. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
            silenius

            Hi Aslak,

             

            By keeping the configuration above and adding @OverProtocol("Servlet 3.0") to my @Deployment method I got this error:

             

            7/Fev/2012 12:09:24 org.jboss.shrinkwrap.impl.base.exporter.zip.JdkZipExporterDelegate$1 call
            WARNING: Exception encountered during export of archive
            org.jboss.shrinkwrap.api.exporter.ArchiveExportException: Failed to write asset to output: /WEB-INF/lib/framework-ejb.jar
                at org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase$3.handle(StreamExporterDelegateBase.java:296)
                at org.jboss.shrinkwrap.impl.base.io.IOUtil.closeOnComplete(IOUtil.java:252)
                at org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase.processNode(StreamExporterDelegateBase.java:247)
                at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:111)
                at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:116)
                at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:116)
                at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.doExport(AbstractExporterDelegate.java:101)
                at org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase.access$001(StreamExporterDelegateBase.java:51)
                at org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase$1.call(StreamExporterDelegateBase.java:125)
                at org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase$1.call(StreamExporterDelegateBase.java:119)
                at org.jboss.shrinkwrap.impl.base.exporter.zip.JdkZipExporterDelegate$1.call(JdkZipExporterDelegate.java:130)
                at org.jboss.shrinkwrap.impl.base.exporter.zip.JdkZipExporterDelegate$1.call(JdkZipExporterDelegate.java:122)
                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                at java.lang.Thread.run(Thread.java:662)
            Caused by: org.jboss.shrinkwrap.api.exporter.ArchiveExportException: java.lang.NoSuchMethodError: org.jacoco.core.instr.Instrumenter.<init>(Lorg/jacoco/core/runtime/IRuntime;)V
                at org.jboss.shrinkwrap.impl.base.exporter.FutureCompletionInputStream.awaitOnFutureOnDone(FutureCompletionInputStream.java:135)
                at org.jboss.shrinkwrap.impl.base.exporter.FutureCompletionInputStream.read(FutureCompletionInputStream.java:83)
                at java.io.PipedInputStream.read(PipedInputStream.java:361)
                at org.jboss.shrinkwrap.impl.base.exporter.FutureCompletionInputStream.read(FutureCompletionInputStream.java:94)
                at java.io.InputStream.read(InputStream.java:85)
                at org.jboss.shrinkwrap.impl.base.io.IOUtil.copy(IOUtil.java:155)
                at org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase$2.execute(StreamExporterDelegateBase.java:283)
                at org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase$2.execute(StreamExporterDelegateBase.java:248)
                at org.jboss.shrinkwrap.impl.base.io.IOUtil.closeOnComplete(IOUtil.java:248)
                ... 15 more
            Caused by: java.lang.NoSuchMethodError: org.jacoco.core.instr.Instrumenter.<init>(Lorg/jacoco/core/runtime/IRuntime;)V
                at org.jboss.arquillian.extension.jacoco.client.InstrumenterAsset.openStream(InstrumenterAsset.java:52)
                at org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase.processNode(StreamExporterDelegateBase.java:241)
                at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:111)
                at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:116)
                at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:116)
                at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:116)
                ... 13 more
            

             

            Any idea on how to fix this?

            • 3. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
              aslak

              Seems like they have updated some API/SPIs, try using jacoco v. 0.5.3.201107060350

              • 4. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
                silenius

                Hi Aslak,

                 

                I've made some progress with jacoco 0.5.3.201107060350.

                 

                I've removed jacoco-maven-plugin from the build section as you suggested.

                I've also removed @OverProtocol("Servlet 3.0") from my @Deployment method. It was causing JBoss to not start SLF4J module defined in my jboss-deployment-structure.xml.

                 

                With this configuration the tests run and generate the file jacoco.exec.

                But jacoco reports are not generated when running mvn site command.

                • 5. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
                  vineet.reynolds

                  Samuel,

                    The Arquillian-jacoco extension does not produce any reports, unlike the jacoco-maven-plugin which has a 'jacoco:report' goal. You could configure your POM to run this goal specifically in post-integration-test phase (if your tests run in the integration-test phase), so that the plugin reads the produced jacoco.exec file to generate reports. Or, you could use Sonar for reporting, where you can instruct Sonar to produce coverage reports from the jacoco.exec file produced by the Arquillian extension.

                  1 of 1 people found this helpful
                  • 6. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
                    silenius

                    Thanks Vineet.

                    That helped.

                    It generated the jacoco reports into the site folder.

                    However, they are not added to maven site "Generated Reports" page.

                    Have you find a way to add it?

                    • 7. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
                      spinner

                      Samuel,

                       

                      the jacoco-plugin cannot be used integrated with maven-site-plugin in 0.5.3 version, that was a feature added in 0.5.6.

                      http://www.eclemma.org/jacoco/trunk/doc/changes.html

                       

                      I guess that we'll have to adapt arquillian-jacoco extension to be able to use 0.5.6 api/spi.

                      1 of 1 people found this helpful
                      • 8. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
                        aslak

                        Created a issue for it: ARQ-738

                         

                        Anyone interested in taking a stab at it?

                        • 9. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
                          silenius

                          Thank you all guys for the help!

                          • 10. Re: Arquillian JBoss AS 7 remote and arquillian-jacoco
                            silenius

                            Hi Aslak,

                            I've already fix it.

                            I will commit it later today.