如何从 Emma 中删除/过滤/忽略某些包(代码覆盖率)

发布于 2024-07-24 14:28:32 字数 839 浏览 4 评论 0原文

我正在尝试从报告中删除一些软件包,但遇到了问题。

有人可以给我一些帮助吗?

我在我的 ant 流程中使用 EMMA。


<代码>
<艾玛>
  <报告
   sourcepath="${build.report.src}"
   metrics="class:${coverage.classes.min},method:${coverage.methods.min}">    <文件集目录=“${build.report.junit.data.dir}”>
     
    
   
   
  


我尝试过使用: <代码>
<过滤器排除=“com.my.package.*”/>

没有成功:(

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰雪梦之恋 2024-07-31 14:28:33

我假设您已经尝试了文档中的所有变体...?

如果是这样,我希望您可能有拼写错误或类似的情况。 您能否提供您正在使用的代码,其中排除语法不起作用,以及错误包含的类的源文件头?

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?

甜中书 2024-07-31 14:28:32

Emma 允许在检测阶段使用过滤器来指定一组需要检测的文件。 相反,您尝试在报告生成阶段执行此操作。 上面给出的链接描述了如何定义检测集。

我使用过这样的过滤器:

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

您还可以使用嵌套的;下的元素

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>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文