EMMA 覆盖率工具不显示逐行覆盖率

发布于 2024-07-07 20:53:43 字数 260 浏览 10 评论 0原文

我正在使用 EMMA 工具进行代码覆盖,但尽管我尽了最大努力,EMMA 仍拒绝查看原始 .java 文件并逐行生成覆盖范围。

我们使用 ANT 构建代码并将 debug 设置为 true。 我知道 EMMA 正在测量覆盖范围,因为 .emma 文件似乎正在正确生成和合并。 这些报告能够以百分比呈现高水平的方法覆盖率。

但为什么它看不到 .java 文件呢? 我得到的只是: [在源路径中找不到源文件“a/b/c/d/e/f/code.java”]

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]

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

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

发布评论

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

评论(4

塔塔猫 2024-07-14 20:53:43

您是否在 report 元素中设置 sourcepath

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

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

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>
╰つ倒转 2024-07-14 20:53:43

您能否发布 build.xml 中生成 EMMA 报告的部分? 听起来像是报告源路径问题。

report sourcepath 应指向您的java 源。

请参阅 EMMA 参考中的源路径。 这可以是类似路径的结构,因此您可以包含多个源目录。

与往常一样,使用 ANT:

  • 使用 -verbose -debug 执行尽可能最小的 build.xml
  • 以获得更多信息。

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.
自由如风 2024-07-14 20:53:43

我遇到了同样的问题。 但发现在设置源路径时我们需要设置为唯一的目录级别而不是java文件位置。 它类似于类路径

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

抚笙 2024-07-14 20:53:43

{java.src.dir} 是否需要指向一个特定的 src 目录。

这不是一个单一的 src 目录,因为我正在编译多个项目。 每个都有自己的 build.xml 文件。

我相信这是生成所有覆盖率报告的部分:

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

编辑:我更改了源路径以直接指向 src 目录之一。 看看是否有效。

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.

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