Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove/filter/ignore some package from Emma (code coverage)

I`m trying to remove some package from my report and having trouble.

Could some one give me some help?

I'm using EMMA in my ant process.


<!-- Generate the emma report both in xml and html -->
<emma>
  <report
    sourcepath="${build.report.src}"
    metrics="class:${coverage.classes.min},method:${coverage.methods.min}">     <fileset dir="${build.report.junit.data.dir}">
      <include name="*.emma"/>
    </fileset>
    <html outfile="${build.report.reports}/emma/raw.html" depth="method"/>
    <xml outfile="${build.report.tmp}/emma.xml" depth="method"/>
  </report>
</emma>


I`ve tried to use:
<filter excludes="com.my.package.*"/>

But with no success :(

like image 380
rafa.ferreira Avatar asked Jun 19 '09 02:06

rafa.ferreira


1 Answers

Emma allows the use of filters at instrumentation phase to specify a set of files that need to be instrumented. In contrast you are trying to do this at report generation phase. The link given above describes how to define the instrumentation set.

I've used filters like this:

<property name="emma.filter" value="-*.unittest.* -*.unittests.* -*.TST* -*TestCase -*Test -*TestSuite" />

<emma>
    <instr instrpath="${build.dir}"
        mode="overwrite"
        metadatafile="${build.dir}/coverage.em"
        filter="${emma.filter}" />
</emma>

You can also use nested <filter> elements under <instr>

like image 80
wheleph Avatar answered Oct 06 '22 20:10

wheleph