3 Replies Latest reply on Mar 29, 2017 7:33 AM by Bartosz Majsak

    Jacoco not caturing Arquillian test coverage.

    Renjith Raj Newbie

      Hi

      I am using Arquillian for integration testing with TomEE container and using Jacoco  for code coverage . But the code coverage shows zero coverage even though tests are successful. My project is a multi module maven project. Below is the part of my parent pom.xml. Should I specify anything in Arquillian.xml other than the plugins and dependencies in pom.xml.

       

      <plugin>

          <groupId>org.jacoco</groupId>

          <artifactId>jacoco-maven-plugin</artifactId>

          <version>0.7.4.201502262128</version>

          <configuration>

              <propertyName>coverageAgent</propertyName>

              <append>true</append>

          </configuration>

          <executions>

              <execution>

                  <id>pre-unit-test</id>

                  <goals>

                      <goal>prepare-agent</goal>

                  </goals>

                  <configuration>

                      <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>

                      <propertyName>surefireArgLine</propertyName>

                      <append>true</append>

                  </configuration>

              </execution>

              <execution>

                  <id>post-unit-test</id>

                  <phase>test</phase>

                  <goals>

                      <goal>report</goal>

                  </goals>

                  <configuration>

                      <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>

                      <outputDirectory>${project.basedir}/../target/coverageReport</outputDirectory>

                      <append>true</append>

                  </configuration>

              </execution>

              <execution>

                  <id>pre-integration-test</id>

                  <phase>pre-integration-test</phase>

                  <goals>

                      <goal>prepare-agent</goal>

                  </goals>

                  <configuration>

                      <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>

                      <propertyName>failsafeArgLine</propertyName>

                  </configuration>

              </execution>

              <execution>

                  <id>post-integration-test</id>

                  <phase>post-integration-test</phase>

                  <goals>

                      <goal>report</goal>

                  </goals>

                  <configuration>

                      <append>true</append>

                      <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>

                      <outputDirectory>${project.basedir}/../target/coverageReport</outputDirectory>

                  </configuration>

              </execution>

          </executions>

      </plugin>

       

       

      <plugin>

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

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

          <version>${maven.surefire.version}</version>

          <configuration>

              <argLine>${surefireArgLine}</argLine>

              <includes>

                  <include>**/*ITest*</include>

              </includes>

              <excludes>

                 <!--  <exclude>**/Test/**</exclude> -->

                  <exclude>**/*IT*</exclude>

              </excludes>

          </configuration>

        </plugin>

       

        <plugin>

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

          <artifactId>maven-failsafe-plugin</artifactId>

          <version>2.7.1</version>

          <configuration>

              <argLine>${failsafeArgLine}</argLine>

              <includes>

                   <include>**/*Test*</include>

              </includes>

          </configuration>

                <executions>

                     <execution>

                         <id>integration-tests</id>

                         <goals>

                             <goal>integration-test</goal>

                             <goal>verify</goal>

                         </goals>

                         <configuration>

                             <argLine>${failsafeArgLine}</argLine>

                             <properties>

                         <property>

                             <name>listener</name>

                             <value>org.sonar.java.jacoco.JUnitListener</value>

                         </property>

                     </properties>

                             <skipTests>false</skipTests>

                         </configuration>

                     </execution>

                 </executions>

        </plugin>

       

       

      Dependencies given

       

                  <dependency>

                      <groupId>org.codehaus.sonar-plugins.java</groupId>

                      <artifactId>sonar-jacoco-listeners</artifactId>

                      <version>2.6</version>

                      <scope>test</scope>

                  </dependency>

                  <dependency>

                <groupId>org.jacoco</groupId>

                <artifactId>org.jacoco.core</artifactId>

                <version>${version.jacoco}</version>

                <scope>test</scope>

             </dependency>

             <dependency>

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

                <artifactId>arquillian-jacoco</artifactId>

                <version>1.0.0.Alpha9</version>

                <scope>test</scope>

             </dependency>