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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What file pattern do you have in ${targethostcloverdbfiles}?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Global coverage files (like coverage.db156znf_hvfkmid5) are rather unique. Their name consists of:
<databasename.db><coverage recorder instance>_<coverage timestamp>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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').
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.