JaCoCo not working for me

Hello,

I have attempted to enable JaCoCo code coverage without success.

My application is Java and built by a Maven3 build step in TeamCity.

Our TeamCity version is TeamCity Enterprise 8.1.5 (build 30240)

An excerpt of the build log as shown in TeamCity is below:

[15:37:32]Checking for changes
[15:37:33]Publishing internal artifacts
[15:37:33]Sending using WebPublisher
[15:37:33]Sending using ArtifactsCachePublisher
[15:37:33]Clearing temporary directory: E:\Apps\TeamCity_BuildAgent\temp\buildTmp
[15:37:33]Using vcs information from server. Reason: no revision information for buildtype calypso-custom and checkout directory E:\Apps\TeamCity_BuildAgent\work\1a0b6fc1b9ff82b1 on agent
[15:37:33]Checkout directory: E:\Apps\TeamCity_BuildAgent\work\1a0b6fc1b9ff82b1
[15:37:33]Updating sources: server side checkout (8s)
[15:37:42]Step 1/1: Maven (21s)
[15:38:03]Generating JaCoCo coverage... (8s)
[15:38:12]JaCoCo report generating finished
[15:38:12]Publishing JaCoCo coverage...
[15:38:12]Coverage was not collected properly. Check your JaCoCo configuration.
[15:38:12]Publishing artifacts
[15:38:12]Collecting files to publish: [E:\Apps\TeamCity_BuildAgent\temp\buildTmp\JACOCO9197961722339615194coverage\jacoco.exec=>.teamcity/coverage_jacoco]
[15:38:12]Publishing using [WebPublisher]
[15:38:12]Publishing using [ArtifactsCachePublisher]
[15:38:12]Publishing artifacts
[15:38:12]Collecting files to publish: [E:\Apps\TeamCity_BuildAgent\temp\buildTmp\JACOCO6423860905072368940coverage\jacoco.log=>.teamcity/coverage_jacoco]
[15:38:12]Publishing using [WebPublisher]
[15:38:12]Publishing using [ArtifactsCachePublisher]
[15:38:12]Publishing artifacts
[15:38:12]Collecting files to publish: [E:\Apps\TeamCity_BuildAgent\temp\buildTmp\JACOCO2165884658326454987coverage\coverage.params=>.teamcity/coverage_jacoco]
[15:38:12]Publishing using [WebPublisher]
[15:38:12]Publishing using [ArtifactsCachePublisher]
[15:38:12]Publishing internal artifacts
[15:38:12]Sending using WebPublisher
[15:38:12]Sending using ArtifactsCachePublisher
[15:38:12]Publishing artifacts
[15:38:12]Collecting files to publish: [calypso-custom/target/*.jar, calypso-custom/target/*.zip]
[15:38:12]Publishing using [WebPublisher]
[15:38:12]Publishing using [ArtifactsCachePublisher]
[15:38:12]Build finished


My Coverage configuration in the project is:

Choose coverage runner:: JaCoCo
Classfile directories or jars: +:src/main/java/**
Classes to instrument: blank

Jacoco Log:

Jacoco report builder run with arguments: [-dataPaths, 'E:\\Apps\\TeamCity_BuildAgent\\temp\\buildTmp\\JACOCO9197961722339615194coverage\\jacoco.exec', -sr, '.', -cp, '+:src/main/java/**', -i, '*', -rd, 'E:\\Apps\\TeamCity_BuildAgent\\temp\\buildTmp\\JACOCO6423860905072368940coverage\\report', -t, 'Calypso', -l, 'true']
Exec files loaded in: 359
Filter set up with includes: [*]; excludes: []
Classfiles read in: 905
Info headers read in: 0
Creating SourceCodeFinder from .
Source files read in: 530
Report written in: 32
Jacoco report builder exits normally


Jacoco.params:

#
#Mon Nov 10 15:38:12 GMT 2014
teamcity.jacoco.coverage.datafile=E\:\\\\Apps\\\\TeamCity_BuildAgent\\\\temp\\\\buildTmp\\\\JACOCO9197961722339615194coverage\\\\jacoco.exec
teamcity.coverage.jacoco.includePatterns=*
teamcity.coverage.jacoco.sources=.
teamcity.coverage.jacoco.classpath=+\:src/main/java/**

Jacoco.exec is attached.

I do not know how to guarrantee that Maven is using forkMode=true when executing tests.

Many thanks, Robin.


Attachment(s):
jacoco (1).exec.zip
1 comment
Comment actions Permalink

I changed to use

Classfile directories or jars:
+:**/classes/**/*.class
-:**/test-classes/**/*.class

based on a separate discussion, and I can now see coverage stats in TeamCity.

You may consider this issue resolved.

Thanks, Robin.

0

Please sign in to leave a comment.