1

I have a multi-modul project with one test modul that tests three others. I have already set up the cobertura instrumentation, merging and reporting with maven antrun-plugin described here: cobertura on maven multi module project but I don't override the normal classes with the instrumented ones but store them in a instrumented-classes folder in every modul. In the post-integration-test phase I merge the cobertura.ser files and generate a report in the pom.xml of the test modul which is executed last.

How can I configure tycho-surefire to use the instrumented classes instead of the normal? Otherwise I get always 0% coverage...

I didn't find an easy solution, the cobertura:aggregate goal doesn't work

Christian
  • 83
  • 5
  • To specify my question: I want to add the instrumented classes in the target/instrumented-classes folder to the tycho-surefire classpath, like [link](https://github.com/cobertura/cobertura/wiki/Ant-Task-Reference) in the Running Tests section with Ant ` ` – Christian Mar 24 '14 at 20:19
  • I have the same problem. If you find a solution please share it – Michal Borek Mar 27 '14 at 17:51

1 Answers1

1

I used Jacoco instead, that worked for me.

<!-- This profile is used to gather code coverage with Jacoco -->
    <profile>
        <id>codeCoverage</id>
        <properties>
            <!-- Properties to enable jacoco code coverage analysis -->
            <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
            <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
            <sonar.jacoco.reportPath>/path/to/jacoco.exec</sonar.jacoco.reportPath>
        </properties>

        <build>
            <plugins>
                <!-- Enabling use of jacoco -->
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-plugin-version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <!-- Where to put jacoco coverage report -->
                                <destFile>${sonar.jacoco.reportPath}</destFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
Christian
  • 83
  • 5