Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Getting different clover coverage info

Hi,

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"/>

</current>

</clover-report>

</target>

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,

Abhinav

1 answer

1 accepted

0 votes
Answer accepted

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

/home/ta230208/coverage.db

while in HtmlReporter you have:

${testsdbfilesdir}/home/ta230208/coverage.db

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}/clovertemp.zip ${targethostcloverdbfiles}"`

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

unzipcloverdbfiles=`cd ${testsdbfilesdir};unzip ${testsdbfilesdir}/clovertemp.zip`

#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??

Regards,

Abhinav

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
TAGS
Community showcase
Published in Jira

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

178 views 2 9
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you