Skip to content

Managed container doesn't generate JaCoCo's coverage report #21

@dudaMeneses

Description

@dudaMeneses

Arquillian runs nicely but integration tests aren't covered by report when managed container is used. Follow below my configurations:

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<dependencies>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-jacoco</artifactId>
        <version>1.0.0.Alpha8</version>
    </dependency>
    <dependency>
        <groupId>org.jacoco</groupId>
        <artifactId>org.jacoco.core</artifactId>
        <version>${jacoco.version}</version>
    </dependency>
</dependencies>
<configuration>
    <append>true</append>
</configuration>
<executions>
    <execution>
        <id>pre-unit-tests</id>
        <phase>process-test-classes</phase>
        <goals>
            <goal>instrument</goal>
        </goals>
        <configuration>
            <destFile>${sonar.jacoco.reportPath}</destFile>
            <propertyName>jacoco.agent.ut.arg</propertyName>
            <append>true</append>
        </configuration>
    </execution>
    <execution>
        <id>post-unit-tests</id>
        <goals>
            <goal>restore-instrumented-classes</goal>
        </goals>
    </execution>
    <execution>
        <id>pre-integration-test</id>
        <phase>package</phase>
        <goals>
            <goal>prepare-agent</goal>
        </goals>
        <configuration>
            <destFile>${sonar.jacoco.itReportPath}</destFile>
            <propertyName>jacoco.agent.it.arg</propertyName>
            <append>true</append>
        </configuration>
    </execution>
    <execution>
        <id>jacoco-merge</id>
        <phase>verify</phase>
        <goals>
            <goal>merge</goal>
        </goals>
        <configuration>
            <fileSets>
                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
                    <directory>target/jacoco</directory>
                    <includes>
                        <include>*.exec</include>
                    </includes>
                </fileSet>
            </fileSets>
            <destFile>target/jacoco.exec</destFile>
        </configuration>
    </execution>
    <execution>
        <id>jacoco-site</id>
        <phase>verify</phase>
        <goals>
            <goal>report</goal>
        </goals>
    </execution>
   </executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12.4</version>
<configuration>
    <environmentVariables>
        <JBOSS_HOME>arquillian.jbossHome</JBOSS_HOME>
    </environmentVariables>
    <argLine>${jacoco.agent.it.arg}</argLine>
    <includes>
        <include>integration/*</include>
    </includes>
    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
    <systemPropertyVariables>
        <arquillian.launch>jboss-managed</arquillian.launch>
    </systemPropertyVariables>
</configuration>
<executions>
    <execution>
        <id>integration-tests</id>
        <phase>integration-test</phase>
        <goals>
            <goal>integration-test</goal>
            <goal>verify</goal>
        </goals>
    </execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
    <skipTests>true</skipTests>
    <systemPropertyVariables>
        <jacoco-agent.destfile>target/jacoco/jacoco-ut.exec</jacoco-agent.destfile>
    </systemPropertyVariables>
</configuration>
<executions>
    <execution>
        <id>unit-tests</id>
        <phase>test</phase>
        <goals>
            <goal>test</goal>
        </goals>
        <configuration>
            <skipTests>false</skipTests>
            <argLine>${jacoco.agent.ut.arg}</argLine>
            <excludes>
                <exclude>integration/*IT.java</exclude>
            </excludes>
        </configuration>
    </execution>
</executions>
</plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions