I downloaded recently Netbeans 8.1 here
I chose second option: "Java EE".
But I can't find how to run test coverage for my unit tests. I have this menu:
It's a Maven Web Application.
When I go to Tools -> Plugins and search for "coverage", I have this:
I installed it and restarted the IDE, I saw it was installing the plugin but there's no change in my menu. If I search "coverage" in the Installed plugins, nothing shows up else than the one I just installed... I thought Netbeans had it implemented? I also thought Netbeans has the Maven test coverage as well...
I read that the plugin I installed (TikiOne JaCoCoverage) is just an extension of the already existing Netbeans Test Coverage.. so that would explain why I can't see it.
How can I enable test coverage?
Thanks.
Code Coverage on the NetBeans Platform In the IDE, go to Tools | Plugins and install "Cobertura Module Test Coverage".
The easiest way to run all the unit tests for the project is to choose Run > Test <PROJECT_NAME> from the main menu. If you choose this method, the IDE runs all the test classes in the Test Packages. To run an individual test class, right-click the test class under the Test Packages node and choose Run File.
Right-click on project > Properties > Coverage to enable code coverage. Then, right-click on project > Run Code Coverage.
you should add the JaCoCo plugin into <plugins>
section of your pom.xml file.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</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>
After you build the project, the menu item for Code Coverage menu item appears when you right-click the project.
Finally, you can select Show Report from the menu. Everything is described here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With