for cobertura ant task: http://cobertura.sourceforge.net/anttaskreference.html
and here is code sample:
<property name="build.coverage.datafile" value="${build.coverage}/cobertura.ser" />
<path id="instrument.classpath"> <pathelement location="${build.classes}" /></path>
<path id="cobertura.classpath"> <pathelement location="cobertura-1.9.4.1.jar" /> <pathelement location="log4j-1.2.4.jar" /> <pathelement location="oro-2.0.8.jar" /> <pathelement location="asm-3.0.jar" /> <pathelement location="asm-tree-3.0.jar" /></path>
<target name="instrument" depends="compile-test"> <taskdef classpathref="cobertura.classpath" resource="tasks.properties" /> <cobertura-instrument todir="${build.instrumented}" datafile="${build.coverage.datafile}"> <includeClasses regex=".*" /> <instrumentationClasspath> <path refid="instrument.classpath" /> </instrumentationClasspath> </cobertura-instrument></target>
<target name="test" depends="compile-test, instrument">
<junit ..;>
...
<sysproperty key="net.sourceforge.cobertura.datafile" file="${build.coverage.datafile}" />
..
</junit>
</target>
<target name="coverage" depends="test"> <taskdef classpathref="cobertura.classpath" resource="tasks.properties" /> <cobertura-report format="xml" destdir="${build.coverage}" srcdir="${src.dir}" datafile="${build.coverage.datafile}" /> <cobertura-check haltonfailure="false" datafile="${build.coverage.datafile}" /></target>
Hiç yorum yok:
Yorum Gönder