This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 227799

Summary: Provide better code coverage integration
Product: java Reporter: tomzi <tomzi>
Component: ProjectAssignee: Tomas Zezula <tzezula>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description tomzi 2013-03-22 07:28:17 UTC
There is no working plugin that does code coverage for tests in maven. Please provide this functionality :) (Using emma....)
Comment 1 tomzi 2013-03-22 09:46:43 UTC
Ignore the comment above I found code coverage support through this page: http://wiki.netbeans.org/MavenCodeCoverage

I created a new profile in my pom, adding:

<build>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.5.7.201204190339</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Then I set my profile via 'Set Configuration' and then 'magically' the new option 'Code Coverage' option appears.

I don't know - is it just me, but this is mightily unuserfriendly. And by the way the coverage plugin does not work for me, for some reaseon, but this is another bug I will raise.

This one is just about user experience
I had to go through a lot of loopholes to get the coverage thingy:
1.) Netbeans did not show me *any* sign of that it was able to do code coverage.
2.) Thus I had to search on the internet, had to install a plugin that didn't work for maven (http://wiki.netbeans.org/TutorialCodeCoveragePlugin) then tried to install another plugin (http://wiki.netbeans.org/MavenCodeCoverage), but NB said it is already installed.
3.) I needed to change my current root pom, to add the above profile. But now I can not check in the pom file, since I am not allowed to. 

Please DO improve the user experience here!
Maybe similar to the current formatting via checkstyle support?
.) Add a new Code Coverage section to 'Project Properties', that would suggest to use a current configuration (profile) or create a new section or help to enable somehow the codecoverage functionality

.) Maybe even add functionality to not be POM invasive to show code coverage, such that I can see coverage without changing my POM's
Comment 2 alied 2014-02-18 21:32:08 UTC
This applies to Windows as well