Hi,
I am trying to do a per test coverage but I keep getting:
"No test results could be found. Please ensure that you have instrumented your unit tests correctly."
I am using the following for letting clover knows where the tests are:
<target name="coverage"> <clover-setup initstring="${coverage.merge.data.dir}/merged.db"> <testsources dir="${core.home}/pathtotestsrccode/"> <include name="*.java" /> <include name="**/*.java" /> <testclass> <testmethod name="test.*"/> </testclass> </testsources> </clover-setup> </target>
1. Is there a way to debug/see which tests clover knows?
2. Obviously I am doing something majorly wrong to get the functional per test coverage and your help shedding some light is greatly appreciated.
Thanks,
Serena
Hi Serena,
There are few things worth checking:
1) Merging databases
Do you merge Clover databases in your build (i.e. do you use <clover-merge> task)? I'm asking because I see that your database is named "merged.db".
If yes, then which databases (a merged or non-merged ones) do you use for test execution? Please note that a merged database can be used for reporting only. When do you merge them? Please note that merge operation shall be performed after test execution (i.e. when coverage recording files are created).
2) Custom test pattern in clover-setup
Do you see any tests detected during code instrumentation by Clover? In your build log you shall see messages like:
[javac] Compiling 3 source files to ...
[clover] Clover Version 4.0.0, built on July 11 2014 (build-917)
...
[clover] Updating existing database at '...\clover.db'.
[clover] Processing files at 1.7 source level.
[clover] Clover all over. Instrumented 3 files (1 package).
[clover] 11 test methods detected.
If you don't see "XX test methods detected." message for your test code, then it means that something is wrong with your <testsources> definition.
I suggest to check:
3) Test sources in clover-report
If you see the "XX test methods detected" messages in your logs and the number of test methods seems to be correct and you still see no test results in your report, then please check your <clover-report> task - do you have the <clover-report>/<current>/<testsources> tag defined pointing to the ${core.home}/pathtotestsrccode"? If this location is not defined, then your test classes may end up on the "Application code" tab instead on the "Test code" tab.
4) Recording per-test coverage files
If you have the <clover-report>/<current>/<testsources> and still no-per test coverage, then please check if you see any *.s coverage recording files (e.g. "merged.dbabc_def_ghijk.s") in a directory where your Clover database is located (the ${coverage.merge.data.dir} in your case).
If you see no such files - do you see at least global coverage files (they're shall be named like merged.dbabcd_efgh or merged.dbabcd_efgh.1)? If none of them are present then it means that you have a problem with coverage recording - the most probably:
- clover.db was not found (you shall see an error message in junit execution logs) or
- you have used merged database instead of a non-merged one (again, check junit logs)
Hi Marek,
Thanks for your reply. I ll investigate and let you know.
Serena
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.