0

We have inherited a NetBeans Modules project (a.k.a. NetBeans Platform project) which builds using the NetBeans Ant tasks. We want to generate a code coverage report of the project to get an idea of what components are not being unit tested. Generating a report is not part of the build process, it is simply something we want to do to understand the existing unit test coverage in the project.

We've decided to use JaCoCo to try and generate this. However the native support in NetBeans is for maven based projects. Unfortunately the TikiOne JaCoCoverage plugin currently does not support NetBeans Modules projects.

We are happy to just drive this via CLI to get an initial report. Does anyone have a success means of doing so under the given constraints?

ale
  • 10,012
  • 5
  • 40
  • 49
al.
  • 1,296
  • 13
  • 14

2 Answers2

0

Someone recently posted a related message to one of NetBeans mailing lists - https://netbeans.org/projects/platform/lists/dev/archive/2014-04/message/124

Short version: Cobertura plugin that does what you're looking for is not maintained now but you can build it and run it.

Radim
  • 4,721
  • 1
  • 22
  • 25
  • Thanks, we tried using Cobertura first, but were having issues with dependencies. In the latest stable release (v2.0.3) the bundled JARs do not match what the shell script includes. This seemed to be the case across all v2 releases. – al. May 06 '14 at 00:49
0

We have been successful in generating the report by doing the following:

  1. Edited the project.properties file to run the JaCoCo agent when unit tests run. This is done by adding the following:

    test.run.args=-javaagent:[yourpath/]jacocoagent.jar=destfile=[yourpath/]jacoco.exec
    
  2. Use Netbeans to run the test task. This produces the jacoco.exec file.

  3. Create a simple ant buildfile to generate reports from an .exec file (see this post)
  4. Run the ant buildfile to generate the report.
Community
  • 1
  • 1
al.
  • 1,296
  • 13
  • 14
  • For the LIFE of me I simply cannot get this to work. How can you tell if Netbeans is actually executing this agent? – robross0606 Jan 25 '18 at 19:55