Getting different clover coverage info


I am getting different code-coverage values when using ANT task and when running through JAVA. I am getting 44 % through ANT and 56 % through Java commandline execution for a clover report.

I am ruuning:

For ANT:

<target name="clover.html">

<delete dir="/home/as185127/results" />

<mkdir dir="/home/as185127/results" />

<clover-report initString="/home/ta230208/coverage.db">

<current outfile="/home/as185127/results" summary="true">

<format type="html" srcLevel="false" showEmpty="true"/>




For Java:

java -classpath ${cloverhome}/clover.jar com.cenqua.clover.reporters.html.HtmlReporter -i ${testsdbfilesdir}/home/ta230208/coverage.db -o ${testshtmldir}/ -h -e

cp -r ${testshtmldir}/* ${teamcityworkdir}/artifacts/html

Please let me know why I am getting this difference?

All my coverage db files are in /home/ta230208

Thanks & Regards,


1 answer

1 accepted

0 votes
Accepted answer

Are you using the same database? In <clover-report> you have:


while in HtmlReporter you have:


so they point to different databases (unless the ${testsdbfilesdir} is empty)

Yes the database location is same.

we are running complete commands from shell as:

#copy first the db file

echo "Copying the clover dbfiles generated .."

zipcloverfiles=`sh ${commondir}/nodecmd ${targethost} "zip -r ${targetmachinetemppath}/ ${targethostcloverdbfiles}"`

noderemotefilescp=`sh ${commondir}/noderemotescp ${targethost} ${targetmachinetemppath}/ ${testsdbfilesdir}`

unzipcloverdbfiles=`cd ${testsdbfilesdir};unzip ${testsdbfilesdir}/`

#clover coverage report.

echo "Gathering clover coverage...."

java -classpath ${cloverhome}/clover.jar com.cenqua.clover.reporters.html.HtmlReporter -i ${testsdbfilesdir}/home/ta230208/coverage.db -o ${testshtmldir}/ -h -e

cp -r ${testshtmldir}/* ${teamcityworkdir}/artifacts/html

#end clover coverage

thanks again.

What file pattern do you have in ${targethostcloverdbfiles}?

Hi Marek,

Thanks for your quick responses, I am analysing the directories. I think there are mismatch in number of coverage files.

One more query, do these coverage files like, coverage.db156znf_hvfkmid5, coverage.dbi3izfe_hvfki29b, coverage.dbi3izfe_hvfkqip5.1, etc are always unique by name? Means suppose if I have executed coverage a month ago and then ran coverage today, then would there be possibility that few of these db files are same??



Global coverage files (like coverage.db156znf_hvfkmid5) are rather unique. Their name consists of:

<databasename.db><coverage recorder instance>_<coverage timestamp>

I think there are mismatch in number of coverage files.

If number of coverage files is different, then possible causes are:

1) Code has been recompiled with different classes/modules in scope.

2) Different set of tests was executed.

3) Project structure has changed (e.g. number of modules has changed, build files were modified).

4) Some coverage recording files were not written to disk (e.g. process was terminated by kill -9).

5) Wrong flush policy is used (e.g. application is running on a server which is not terminated after tests and at the same time a flush policy is set to 'directed').

Hi Marek,

Yes I think we are doing 1 & 2 steps in our project. I will resolve these and let you know for any issues.

Thanks again for your valuable answers.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 3 hours ago in Agile

How Scrum works? It starts with training and education

To answer “How scrum works,” most of the teams I've worked with first addressed the question: “where to start?”  That question applies to both implementation and improvements on the Scrum framew...

50 views 1 3
Read article

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