del
del

Reputation:

EMMA coverage tool not displaying line-by-line coverage

I am using the EMMA tool for code coverage yet despite my best efforts, EMMA is refusing to see the original .java files and generate coverage on a line-by-line basis.

We are using ANT to build the code and debug is set to true. I know that EMMA is measuring coverage as the .emma files seem to be generating and merging correctly. The reports are able to present high level method coverage with percentages.

But why won't it see the .java files? All I get is: [source file 'a/b/c/d/e/f/code.java' not found in sourcepath]

Upvotes: 5

Views: 3884

Answers (4)

del
del

Reputation:

does {java.src.dir} need to point to one specific src directory.

This is no one single src directory as I am compiling multiple projects. Each with their own build.xml file.

I believe this is the portion that generates all the coverage reports:

  <target name="emma.report" if="use.emma">
   <emma enabled="true">
     <report sourcepath="${test.reports.dir}">
       <!--  collect all EMMA data dumps (metadata and runtime):   --> 
       <infileset dir="${test.data.dir}" includes="*.emma" /> 
       <html outfile="${test.reports.dir}/coverage.html" /> 
     </report>
   </emma>
 </target>

EDIT: I changed the sourcepath to point directly to one of the src directories. See if that works.

Upvotes: 0

Uma
Uma

Reputation: 11

I ran into the same issue. But found that while setting the sourcepath we need to set to the only directory level not to the java file location. it is similar to the classpath

Upvotes: 1

Ken Gentle
Ken Gentle

Reputation: 13357

Could you post the portion of your build.xml that generates the EMMA reports? Sounds like a report sourcepath issue.

report sourcepath should point to your java source.

See sourcepath in the EMMA reference. This can be a path-like structure, so you can include multiple source directories.

As always, with ANT:

  • execute the smallest possible build.xml with -verbose
  • -debug for even more information.

Upvotes: 2

user7094
user7094

Reputation:

Are you setting the sourcepath in your report element?

<report>
    <sourcepath>
        <pathelement path="${java.src.dir}" />
    </sourcepath>
    <fileset dir="data">
        <include name="*.emma" />
    </fileset>

    <txt outfile="coverage.txt" />
    <html outfile="coverage.html" />
</report>

Upvotes: 6

Related Questions