How can I remove/filter/ignore some package from E

2019-06-19 18:57发布

问题:

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 :(

回答1:

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>



回答2:

I assume you've tried all of the variations in the documentation...?

If so, I expect that you may have a typo, or something like that. Can you provide the code you're using with the exclude syntax that doesn't work, and the header of the source file for the class that is incorrectly being included?