Hi, I am using Emma for code-coverage for my project. In my JUnit test case, I am calling a method but in code coverage report, it shows no coverage for that method which is getting called from testCase.
views:
31answers:
1
A:
Check these points:
Set a breakpoint in the method to make sure it is really called.
You can tell emma to omit some classes. Check the config.
Is the class properly instrumented?
Aaron Digulla
2010-04-01 10:38:29
Hi Aaron, I have checked that the method is getiing called. In my build.xml, for emma, <target name="emma" depends="emmainit" description="turns on EMMA instrumentation" > <emma enabled="${emma.enabled}"> <instr instrpathref="run.classpath" mode="copy" destdir="${instr.dir}" metadatafile="${coverage.dir}/metadata.em"> </instr> </emma> </target> The <instrpathref> is referring to the folder where my class file are stored after compile. Is it correct or i need to give my instrumented class folder path here?
lavanya
2010-04-01 10:46:17
Please edit your question and put the code there so it is readable.
Aaron Digulla
2010-04-01 11:43:27
A simple check is to delete the class file in the dest dir of the emma target ("${instr.dir}") and then run the target again. If the file is created, it should be instrumented. The next check is whether the file size is the same as the original class file.
Aaron Digulla
2010-04-01 11:44:51
Hi Aaron, I did the checks which u suggested. instrumented files are getting generated and its size is same as original class file. Any other suggestion/checks to solve this issue? I m getting proper coverage.ec file and but in html report, the method called is shown as not covered.
lavanya
2010-04-01 12:52:32
Thanks Aaron. Problem is solved. Actually the junit testcase was referring the class files in another folder and instrumented classes were getting copied in some another folder.. Now i have made the junit classes to refer to the class files where instrumneted classes are getting copied. once again thanks.
lavanya
2010-04-01 13:14:42