After a lot of trying and searching around, I still could not get undercover to work with ant and scalatest. although there is no error, The report always shows 0% eventhough I have test cases. Below is the relevant part of my build.xml
<target name="instrumentClasses" depends="test">
<taskdef resource="undercover-ant.properties" classpathref="undercover.classpath" />
<undercover-instrument destdir="${undercover.dir}/instrumented" metadatafile="${undercover.dir}/undercover.md">
<instrumentpath>
<pathelement location="${classes.dir}" />
</instrumentpath>
</undercover-instrument>
</target>
<target name="runInstrumentedTests" depends="instrumentClasses">
<scalatest fork="true">
<runpath>
<pathelement location="${undercover.dir}/instrumented"/>
<path refid="undercover.classpath"/>
<pathelement location="${testclasses.dir}"/>
<path refid="${classes.dir}"/>
</runpath>
</scalatest>
</target>
<target name="coverageReport" depends="runInstrumentedTests">
<undercover-report metadatafile="${undercover.dir}/undercover.md" coveragedatafile="${undercover.dir}/undercover.cd" sourceencoding="UTF-8">
<sourcepath>
<pathelement location="${source.dir}" />
<pathelement location="${testsrc.dir}" />
</sourcepath>
<html output="${undercover.dir}" />
<emmaxml output="${undercover.dir}/emma/coverage.xml" />
<coberturaxml output="${undercover.dir}/cobertura/coverage.xml" />
</undercover-report>
<!--delete dir="${undercover.dir}/instrumented"/-->
</target>
I think that the file created during the runInstrumentedTests is not being read by the undercover coverage. And I have no idea what the undercover.cd is doing?
Please let me know if this works. Thanks