[antlr-interest] maven-gunit-plugin not working correctly with cobertura

Kaleb Pederson kaleb.pederson at gmail.com
Wed Sep 30 15:24:49 PDT 2009


I have maven-gunit-plugin setup and running gunit tests for my
grammar.  The tests run successfully and well, covering most of the
grammar. The coverage resulting from the tests, however, does not show
up in Cobertura and I'm not sure why.

Here's some details from my cobertura:cobertura run


#
# grammar is compiled first
#
[INFO] Preparing cobertura:cobertura
[INFO] [antlr3:antlr {execution: antlr3-maven-plugin}]
[INFO] ANTLR: Processing source directory
/home/kibab/workspace/compiler/src/main/antlr3
ANTLR Parser Generator  Version 3.1.3 Mar 17, 2009 19:23:44
com/sophware/.../AccessLanguage.g


#
# correct classes are instrumented per include/exclude statements
#
[INFO] [cobertura:instrument {execution: default-instrument}]
[INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 4 files to
/home/kibab/workspace/compiler/target/generated-classes/cobertura
Cobertura: Saved information on 4 classes.
Instrument time: 156ms
[INFO] Instrumentation was successful.


#
# JUnit tests are compiled
#
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 4 source files to
/home/kibab/workspace/compiler/target/test-classes


#
# JUnit tests run successfully
#
Running com.sophware...ModelTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.029 sec
...
Tests run: 3, Failures: 0, Errors: 0, Skipped: 1


#
# GUnit tests run successfully and use the instrumented classes
#
[INFO] [gunit:gunit {execution: maven-gunit-plugin}]
[INFO] Adding Antlr artifact : org.antlr:antlr:jar:3.1.3
[INFO] Adding project compile classpath element :
/home/kibab/workspace/compiler/target/test-classes
[INFO] Adding project compile classpath element :
/home/kibab/workspace/compiler/target/generated-classes/cobertura
-----------------------------------------------------------
 G U N I T   R E S U L T S
-----------------------------------------------------------
Executing script
/home/kibab/workspace/compiler/src/test/gunit/AccessLanguage.testsuite
Tests run: 42,  Failures: 0,  Invalid: 0


#
# Cobertura report is generated
#
[INFO] [cobertura:cobertura {execution: default-cli}]
[INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 4 classes.
Report time: 530ms
[INFO] Cobertura Report generation was successful.

Coverage from my JUnit tests shows up, but not from GUnit.  They run
in sequence using the instrumented classes.  Any thoughts?  Is GUnit
using a separate classloader or something else that might affect it?

Thanks.

--Kaleb


More information about the antlr-interest mailing list