EMMA 不会涵盖我的一个项目

发布于 2024-07-09 04:43:01 字数 1514 浏览 12 评论 0原文

我对 EMMA 有一个问题,它正确地覆盖了我所有的各种 Java 项目,除了一个项目。 我很困惑为什么会发生这种情况,因为 ANT 脚本似乎是正确的。 给出以下预期输出:

 [echo] c:\cc_local_home\emmadata\ProjectName
[instr] processing instrumentation path ...
[instr] instrumentation path processed in 1876 ms
[instr] [84 class(es) instrumented, 0 resource(s) copied]
[instr] metadata merged into [c:\cc_local_home\data\2008-11-17_14.35.19\coverage.emma] {in 62 ms}

上述内容由以下 ANT 脚本生成:

<target name="emma" depends="init" if="use.emma">
  <echo message="${emma.bin}" /> 
  <emma enabled="true">
    <instr instrpath="${test.bin}" destdir="${emma.bin}" metadatafile="${test.data.dir}/coverage.emma" merge="true">
      <filter excludes="*Test*,*test*" /> 
      <filter excludes="*Exception" /> 
      <filter excludes="*AppConstants" /> 
    </instr>
  </emma>
</target>

运行 JUnit 测试后,将记录以下内容。

艾玛报告: [报告]处理输入文件...
[报告] 16 毫秒内读取并合并 1 个文件
[报告]无事可做:在任何数据文件中都找不到运行时覆盖率数据

并且不会生成覆盖率报告。

我确信coverage.emma 文件已正确链接,那么为什么 EMMA 不覆盖代码?

emma.report 任务如下所示:

<target name="emma.report" if="use.emma">
  <emma enabled="true">
    <report sourcepath="${test.reports.dir}"> 
      <infileset dir="${test.data.dir}" includes="*.emma" /> 
      <html outfile="${test.reports.dir}/coverage.html" /> 
    </report>
  </emma>
</target>

I have an issue with EMMA where it is correctly covering all my various Java projects except one.
I am puzzled as to why this occurs as the ANT script appears to be correct. The following expected output is given:

 [echo] c:\cc_local_home\emmadata\ProjectName
[instr] processing instrumentation path ...
[instr] instrumentation path processed in 1876 ms
[instr] [84 class(es) instrumented, 0 resource(s) copied]
[instr] metadata merged into [c:\cc_local_home\data\2008-11-17_14.35.19\coverage.emma] {in 62 ms}

The above is generated by the following piece of ANT script:

<target name="emma" depends="init" if="use.emma">
  <echo message="${emma.bin}" /> 
  <emma enabled="true">
    <instr instrpath="${test.bin}" destdir="${emma.bin}" metadatafile="${test.data.dir}/coverage.emma" merge="true">
      <filter excludes="*Test*,*test*" /> 
      <filter excludes="*Exception" /> 
      <filter excludes="*AppConstants" /> 
    </instr>
  </emma>
</target>

After the JUnit tests are run, the following is logged.

emma.report:
[report] processing input files ...
[report] 1 file(s) read and merged in 16 ms
[report] nothing to do: no runtime coverage data found in any of the data files

And no coverage report is generated.

I am certain that the coverage.emma files are being linked correctly so why is EMMA not covering the code?

The emma.report task looks like the following:

<target name="emma.report" if="use.emma">
  <emma enabled="true">
    <report sourcepath="${test.reports.dir}"> 
      <infileset dir="${test.data.dir}" includes="*.emma" /> 
      <html outfile="${test.reports.dir}/coverage.html" /> 
    </report>
  </emma>
</target>

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

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

发布评论

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

评论(4

海风掠过北极光 2024-07-16 04:43:01

元素是什么样的?

您可能需要查看有关此确切消息的常见问题解答:< a href="http://emma.sourceforge.net/faq.html#q.report.noop" rel="nofollow noreferrer">为什么说“无事可做:没有......在任何数据文件中找到数据”并退出而不生成任何内容?

并且,与 Ant 一样,打开 -verbose 并仔细检查输出。

What does the <emma.report> element look like?

You may want to look at this FAQ concerning this exact message: Why does <report></report> say "nothing to do: no ...data found in any of the data files" and exit without generating anything?

And, as always with Ant, turn on -verbose and double check the output.

风苍溪 2024-07-16 04:43:01

我会检查以确保 JUnit 目标正在运行已检测的代码,而不是运行未检测的代码(这不会产生任何覆盖率数据)。

I would check to make sure that the JUnit target is running the instrumented code, and not running non-instrumented code (which would not produce any coverage data).

人心善变 2024-07-16 04:43:01
<target name="emma.report" if="use.emma">
  <emma enabled="true">
    <report sourcepath="${test.reports.dir}"> 
      <infileset dir="${test.data.dir}" includes="*.emma" /> 
      <html outfile="${test.reports.dir}/coverage.html" /> 
    </report>
  </emma>
</target>
<target name="emma.report" if="use.emma">
  <emma enabled="true">
    <report sourcepath="${test.reports.dir}"> 
      <infileset dir="${test.data.dir}" includes="*.emma" /> 
      <html outfile="${test.reports.dir}/coverage.html" /> 
    </report>
  </emma>
</target>
眼趣 2024-07-16 04:43:01

当您使用错误的命令生成报告时,您会收到此错误。 大多数在线教程都提倡错误的(可能是旧的)命令,即使我在使用以下命令生成报告时遇到此错误:

{JAVA_HOME}\jre\lib\ext>java -cp emma.jar emma report - r html -incoverage.em, {ALFRESCO_HOME}\coverage.ec
EMMA:处理输入文件...
EMMA:60 毫秒内读取并合并 1 个文件
EMMA:无事可做:在任何数据文件中都找不到运行时覆盖率数据

该命令的正确用法是:
{JAVA_HOME}\jre\lib\ext>java -cp emma.jar emma report -r txt,html -in {JAVA_HOME}\jre\lib\ext\coverage.em -in C:\t1_tempSetup\Alfresco\覆盖率.ec
EMMA:处理输入文件...
EMMA:在 70 毫秒内读取并合并 2 个文件 EMMA:将 [txt] 报告写入 [{JAVA_HOME}\jre\lib\ext\coverage.txt] ...
EMMA:将 [html] 报告写入 [{JAVA_HOME}\jre\lib\ext\coverage\index.html]

You get this error when you use wrong command to generate the report. Most of the online tutorial is advocating the wrong(may by old) command, even I got this error when I used below command to generate the report:

{JAVA_HOME}\jre\lib\ext>java -cp emma.jar emma report -r html -in coverage.em, {ALFRESCO_HOME}\coverage.ec
EMMA: processing input files ...
EMMA: 1 file(s) read and merged in 60 ms
EMMA: nothing to do: no runtime coverage data found in any of the data files

Correct usage of the command is:
{JAVA_HOME}\jre\lib\ext>java -cp emma.jar emma report -r txt,html -in {JAVA_HOME}\jre\lib\ext\coverage.em -in C:\t1_tempSetup\Alfresco\coverage.ec
EMMA: processing input files ...
EMMA: 2 file(s) read and merged in 70 ms EMMA: writing [txt] report to [{JAVA_HOME}\jre\lib\ext\coverage.txt] ...
EMMA: writing [html] report to [{JAVA_HOME}\jre\lib\ext\coverage\index.html]

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