tags:

views:

31

answers:

1

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.

A: 

Check these points:

  1. Set a breakpoint in the method to make sure it is really called.

  2. You can tell emma to omit some classes. Check the config.

  3. Is the class properly instrumented?

Aaron Digulla
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
Please edit your question and put the code there so it is readable.
Aaron Digulla
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
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
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