Hi
I am using cactus to test my in container test cases and am able to do so successfully. I want to use cobertura to check for my code coverage. I am able to instrument my files. The following is the process that i use to do the cobertura check
clean>build>deploy>instrument>startserver>test using cactus>stopserver>generate cobertura report
But when i start the stop server process i see that a cobertura.ser.lock file is generated. and after the stop server process is completed the lock file still remains. And on generating the report i get 0% coverage. i am pretty sure that this is caused because the lock file still remains.
Any suggestions on how to get rid of this lock file after the stopserver process (without manual deletion of course!). After this I am sure i will be able to see the code coverage.
My buildAll.xml looks like this:
<!-- <taskdef classpath="C:/cobertura-1.9/cobertura.jar" resource="tasks.properties" /> -->
<property name="cobertura.dir" value="C:/cobertura-1.9" />
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar" />
<include name="**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<!-- - - - - - - - - - - - - - - - - -
target: instrument ,compile.classes
- - - - - - - - - - - - - - - - - -->
<target name="instrument" depends="init,compile.classes" description=" --> Instrument compiled classes for code coverage and create jar">
<echo>--------------------------------------------------</echo>
<echo>Executing the **instrument** target</echo>
<echo>--------------------------------------------------</echo>
<delete file="${cobertura.ser}" />
<delete file="${instrumented.dir}/com/**/*.*" />
<cobertura-instrument todir="${instrumented.dir}" datafile="${cobertura.ser}/">
<ignore regex="org.apache.log4j.*" />
<fileset dir="${build.dir}">
<include name="com/logistics/ucl/admin/**/*.class" />
<include name="com/logistics/ucl/api/**/*.class" />
<include name="com/logistics/ucl/auth/**/*.class" />
<include name="com/logistics/ucl/client/**/*.class" />
<include name="com/logistics/ucl/data/**/*.class" />
<include name="com/websina/**/*.class" />
<exclude name="**/ClientTest.class" />
</fileset>
<fileset dir="${workspace}/../Javalib/builddir">
<include name="com/logistics/javalib/admin/ucl/**/*.class" />
<include name="com/logistics/javalib/domain/id/**/*.class" />
<include name="com/logistics/javalib/util/**/*.class" />
</fileset>
</cobertura-instrument>
<delete dir="${build.dir}/com" />
<copydir src="${instrumented.dir}" dest="${build.dir}" includes="**/*.class" />
</target>
<target name="coverage-report">
<echo>--------------------------------------------------</echo>
<echo>Executing the **coverage-report** target</echo>
<echo>--------------------------------------------------</echo>
<cobertura-report format="html" destdir="${basedir}/../CoberturaCoverageReport">
<fileset dir="${basedir}/../source/main/java">
<include name="**/*.java" />
<exclude name="**/*Test.java" />
</fileset>
<fileset dir="${basedir}/../../Javalib/source/main/java/">
<include name="com/logistics/javalib/**/*.java" />
</fileset>
</cobertura-report>
<fail message="Tests failed. Check log and/or reports." if="test.failed" />
</target>
Thanks