1

I am quite new to maven scoverage plugin which is the preferred code coverage tool in the team that I am working with. I am trying to generate reports for test coverage using the following command:

 mvn scoverage:report

It gives me a detailed report showing class name and code coverage both in terms of lines of code and branches but it does not show which lines/branches of code are not covered by unit tests.

Is there an option with scoverage that I can use to display those lines or generate as part of report?

I have tried googling but haven't been able to find anything helpful for scoverage

Vikas Saxena
  • 1,073
  • 1
  • 12
  • 21

1 Answers1

0

So Finally I figured it out, all i needed to do was put a small change in plug-in section for scoverage of my pom file and set highlighting to true

Before:

<plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>${scoverage.plugin.version}</version>
                <configuration>
                    <minimumCoverage>80</minimumCoverage>
                    <failOnMinimumCoverage>true</failOnMinimumCoverage>
                    <aggregate>true</aggregate>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal> <!-- or integration-check -->
                        </goals>
                        <phase>prepare-package</phase> <!-- or any other phase -->
                    </execution>
                </executions>
            </plugin>

After:

<plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>${scoverage.plugin.version}</version>
                <configuration>
                    <highlighting>true</highlighting>
                    <minimumCoverage>80</minimumCoverage>
                    <failOnMinimumCoverage>true</failOnMinimumCoverage>
                    <aggregate>true</aggregate>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal> <!-- or integration-check -->
                        </goals>
                        <phase>prepare-package</phase> <!-- or any other phase -->
                    </execution>
                </executions>
            </plugin>
Vikas Saxena
  • 1,073
  • 1
  • 12
  • 21