Clover plugin for grails does not collect coverage for unit tests

We are using clover to coverage our grails applications.

Unfortunately it seems that the unit tests, albeit run, are not taken in account in the coverage report.

We run this grails command:

grails --non-interactive --stacktrace --verbose -clover.on test test-app

And we can see this kind of logs:


Clover: using default clover-setup configuration.

build	11-Oct-2012 16:43:59	Clover:

build	11-Oct-2012 16:43:59	               directories: [src/java, src/groovy, test/unit, test/integration, grails-app]

build	11-Oct-2012 16:43:59	               includes:    [**/*.groovy, **/*.java]

build	11-Oct-2012 16:43:59	               excludes     [**/conf/**, **/plugins/**]

build	11-Oct-2012 16:43:59	[clover-setup] Clover Version 3.1.6, built on June 19 2012 (build-867)

build	11-Oct-2012 16:43:59	[clover-setup] Loaded from: /home/jira/.grails/ivy-cache/com.cenqua.clover/clover/jars/clover-3.1.6.jar

build	11-Oct-2012 16:43:59	[clover-setup] Clover: Academic License registered to CERN.

build	11-Oct-2012 16:43:59	[clover-setup] Clover is enabled with initstring '/home/jira/.grails/2.0.4/projects/ais-core/clover/db/clover.db'


[clover-setup] Creating new database at '/home/jira/.grails/2.0.4/projects/ais-core/clover/db/clover.db'.

build	11-Oct-2012 16:44:07	[clover-setup] Processing files at 1.6 source level.

build	11-Oct-2012 16:44:08	[clover-setup] Clover all over. Instrumented 72 files (22 packages).

build	11-Oct-2012 16:44:08	[clover-setup] Elapsed time = 0.697 secs. (103.3 files/sec, 9,383.07 srclines/sec)


Clover: Test source compilation phase ended


| Running 36 unit tests...


| Completed 36 unit tests, 0 failed in 3542ms


| Packaging Grails application

build	11-Oct-2012 16:44:29	Clover: Compile start.

build	11-Oct-2012 16:44:29	| Packaging Grails application.

build	11-Oct-2012 16:44:29	[clover-setup] Updating existing database at '/home/jira/.grails/2.0.4/projects/ais-core/clover/db/clover.db'.

build	11-Oct-2012 16:44:29	[clover-setup] Processing files at 1.6 source level.

build	11-Oct-2012 16:44:29	[clover-setup] Clover all over. Instrumented 1 file (1 package).

build	11-Oct-2012 16:44:29	[clover-setup] Elapsed time = 0.003 secs. (333.333 files/sec, 3,000 srclines/sec)


Clover: Test source compilation phase ended

build	11-Oct-2012 16:45:20	| Running 50 integration tests...


Completed 50 integration tests, 29 failed in 20627ms


Clover: Tests ended

build	11-Oct-2012 16:45:41	Clover: Generating report using default 'clover-report' task

Bamboo is displaying "29 of 86 failed" but the coverage report displays only 50 tests and associated coverage.

1 answer

1 accepted

1 vote
Answer accepted

Grails 2.x has introduced new compiler named '[testc]' (org.codehaus.groovy.grails.test.compiler.GrailsTestCompiler), which is being used to compile unit tests. You can notice it in the build log (with -clover.debug option):

|Compiling 1 source files
    [testc] ... \test\unit\UnitTests.groovy

|Compiling 1 source files
  [groovyc] ... \test\integration\IntegrationServiceTests.groovy

Current Grails Clover Plugin (3.1.6) does not intercept this compiler yet. The CLOV-1167 scheduled for Clover 3.1.8 will solve this problem.


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Friday in United States

Confluence Security Advisory

Good morning Members, Not sure if you are aware. Please read the following: More details: https://co...

46 views 1 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you