Question

I'm trying to integrate emma with an ant build, that does junit testing. My current code runs as : ant tests

I'm trying the offline instrumentation: http://emma.sourceforge.net/userguide_single/userguide.html#N10291

So I changed the target line to be: target name="run" depends="init, test" description="runs the examples"

So I run ant emma run However I get the following error:

commonstest: [junit] Running com.fourhome.commons.AllTests [junit] Tests run: 24, Failures: 0, Errors: 0, Time elapsed: 0.433 sec

run:

BUILD FAILED C:\code\svn\core\core\trunk\build-targets.xml:929: Problem: failed to create tas k or type emma Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any / declarations have taken place.

The failure line is:emma enabled="${emma.enabled}"

I'm guessing emma.enabled is not defined. How should I define it?

Was it helpful?

Solution

As per the docs on the page you linked to, either "true" or "false". From the <emma> task:

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

As you provide no context for the line in question, I'm guessing. If you search the same page you link to you will find other examples and tasks in which that property is used, how to set the property for a variety of scenarios, and how to use the auxiliary "emma" target. The above is a mix of two examples.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top