0

我正在尝试将 emma 与进行 junit 测试的 ant 构建集成。我当前的代码运行为:ant tests

我正在尝试离线仪器: http ://emma.sourceforge.net/userguide_single/userguide.html#N10291

所以我将目标行更改为: target name="run" depends="init, test" description="runs the examples"

所以我运行 ant emma run 但是我收到以下错误:

commonstest:[junit] 运行 com.fourhome.commons.AllTests [junit] 测试运行:24,失败:0,错误:0,经过时间:0.433 秒

跑:

BUILD FAILED C:\code\svn\core\core\trunk\build-targets.xml:929: 问题:未能创建任务或键入 emma 原因:名称未定义。行动:检查拼写。行动:检查是否已声明任何自定义任务/类型。行动:检查任何/声明已经发生。

失败行是:emma enabled="${emma.enabled}"

我猜 emma.enabled 没有定义。我应该如何定义它?

4

1 回答 1

1

根据您链接到的页面上的文档,要么"true"要么"false"。从<emma>任务:

<target name="emma" description="turns on EMMA's on-the-fly instrumentation mode" >
  <property name="emma.enabled" value="true" />
</target>

<target name="run" depends="init, compile" description="runs the examples" >
    <emma enabled="${emma.enabled}" >
      <instr instrpathref="run.classpath"#B0.5-co
             destdir="${out.instr.dir}" 
             metadatafile="${coverage.dir}/metadata.emma"
             merge="true"
      />
    </emma>
  </emmajava>
</target>

由于您没有为有问题的行提供上下文,我猜。如果您搜索链接到的同一页面,您会发现使用该属性的其他示例和任务,如何为各种场景设置属性,以及如何使用辅助"emma"目标。以上是两个示例的混合。

于 2012-03-08T21:46:51.113 回答