Hello Leela,

please just google for jacoco and powermock, both modify the loaded
classes, so depending on your scenario different approaches are valid.

Regards
Mirko
-- 
Sent from my mobile
On May 6, 2015 7:05 PM, "leela kumili" <[email protected]> wrote:

> Have a multi-module maven project.
>
> Each module has couple of testng and powermock unit test cases. We are
> using jacoco for code coverage report. But, jacoco is analyzing unit test
> coverage based on testng unit test cases and ignoring powermock unit test
> case. So, total code coverage is coming low.
>
> Here is how I have configured the jacoco-maven-plugin and unit-test cases:
>
> Jacoco-Maven-Plugin configuration:
>
> <plugin>
> <groupId>org.jacoco</groupId>
> <artifactId>jacoco-maven-plugin</artifactId>
> <version>${jacoco-maven-plugin.version}</version>
> <configuration>
> <propertyName>coverageAgent</propertyName>
> <append>true</append>
> </configuration>
> <executions>
> <!-- Prepares the property pointing to the JaCoCo runtime agent which
> is passed as VM argument when Maven the Surefire plugin is executed. -->
> <execution>
> <id>pre-unit-test</id>
> <goals>
> <goal>prepare-agent</goal>
> </goals>
> <configuration>
> <!-- Sets the path to the file which contains the execution data. -->
> <destFile>${sonar.jacoco.reportPath}</destFile>
> <!-- Sets the name of the property containing the settings for JaCoCo
> runtime agent. -->
> <propertyName>surefireArgLine</propertyName>
> </configuration>
> </execution>
> <!-- Ensures that the code coverage report for unit tests is created
> after unit tests have been run. -->
> <execution>
> <id>post-unit-test</id>
> <phase>test</phase>
> <goals>
> <goal>report</goal>
> </goals>
> <configuration>
> <!-- Sets the path to the file which contains the execution data. -->
> <dataFile>${sonar.jacoco.reportPath}</dataFile>
> <excludes>
> <exclude>com.walmart.services.*</exclude>
> </excludes>
> <!-- Sets the output directory for the code coverage report. -->
> <outputDirectory>${jacoco.reports.unit.dir}</outputDirectory>
> </configuration>
> </execution>
>  </executions>
> </plugin>
>
>
> Unit-test case profile:
>
> <!-- For mapping unit tests and covered code -->
> <profile>
> <id>jacoco-ut</id>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <configuration combine.self="override">
> <testFailureIgnore>true</testFailureIgnore>
> <threadCount>25</threadCount>
> <argLine>${surefireArgLine}</argLine>
> <suiteXmlFiles>
> <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
> </suiteXmlFiles>
> </configuration>
> </plugin>
> <plugin>
> <artifactId>maven-failsafe-plugin</artifactId>
> <version>2.12</version>
> <dependencies>
> <dependency>
> <groupId>org.apache.maven.surefire</groupId>
> <artifactId>surefire-junit47</artifactId>
> <version>2.10</version>
> </dependency>
> <dependency>
> <groupId>org.jacoco</groupId>
> <artifactId>org.jacoco.agent</artifactId>
> <version>${jacoco-maven-plugin.version}</version>
> </dependency>
> </dependencies>
> </plugin>
> </plugins>
> </build>
> </profile>
>
> --
> You received this message because you are subscribed to the Google Groups
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/ebeba784-9a19-4c8a-954f-791176f5cc0d%40googlegroups.com
> <https://groups.google.com/d/msgid/jacoco/ebeba784-9a19-4c8a-954f-791176f5cc0d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/CAK8jvqwFC1k7ENtP6h2KMEx6iONTaUmMX6b3tZ2fomhf56oH2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to