Command-line EMMA for NetBeans projects

NetBeans has an integrated EMMA plugin for gathering coverage data from JUnit automated tests. But sometimes you may want coverage data from system tests. If you don't have automated system tests, you can still use EMMA to get coverage data for manual tests. You run EMMA from the command line and perform you manual tests "on-the-fly."

In this example, the current directory is the root directory of the NetBeans project.
The classes we want coverage data for are in a package "model".
Getting the results is a three step process. 
  1. "Instrument" the class files.
  2. Perform the manual tests while EMMA is running.
  3. Analyze the coverage data and produce the report.
$ ls build/classes/
main model resources view
$ java -cp emma.jar emma instr -ip build/classes/model/ -m overwrite
EMMA: processing instrumentation path ...
EMMA: instrumentation path processed in 153 ms
EMMA: [7 class(es) instrumented, 0 resource(s) copied]
EMMA: metadata merged into [/home/IntegratedProject/coverage.em] {in 59 ms}
$ java -cp emma.jar:build/classes:. main.Main
EMMA: collecting runtime coverage data ...
(Manual "on-the-fly" tests are performed here).
EMMA: runtime coverage data merged into [/home/IntegratedProject/coverage.ec] {in 53 ms}
$ java -cp emma.jar emma report -r html -in coverage.em -in coverage.ec -sp src/model/
EMMA: processing input files ...
EMMA: 2 file(s) read and merged in 16 ms
EMMA: writing [html] report to [/home/IntegratedProject/coverage/index.html] ...
$ ls
build coverage coverage.em manifest.mf Saves
build.xml coverage.ec emma.jar nbproject src
$ cd coverage/
/coverage$ ls
_files index.html
/coverage$ firefox index.html