From: yamaduc <ya...@gm...> - 2005-08-23 18:24:09
|
Hi all, I have the following build script. <target name=3D"instrument" depends=3D"compile" description=3D"Add Cobertur= a instrumentation"> =09=09<!-- instrument the application classes, writing the instrumented classes into ${instrumented.classes}. --> =20 =09=09<cobertura-instrument datafile=3D"${test.dir}/cobertura.ser" todir=3D"${instrumented.classes}"> =09=09=09<!-- Note that the following line causes instrument to ignore any =09=09=09 source line containing a reference to log4j, for the purposes =09=09=09=09 of coverage reporting. --> =09=09=09<ignore regex=3D"org.apache.log4j.*"/> =20 =09=09=09<fileset dir=3D"${classes.dir}"> =09=09=09=09<!-- instrument all the application classes, but don't instrume= nt the test classes. --> =09=09=09=09<include name=3D"**/*.class"/> =09=09=09=09<exclude name=3D"**/*Test.class"/> =09=09=09</fileset> =09=09</cobertura-instrument> </target> <target name=3D"test" depends=3D"prepare.test.package" description=3D"Run the tests on the defined container"> =09=09<!-- Run the tests --> =09=09<mkdir dir=3D"${test.results}/tomcat4x"/> =09=09<cactus warfile=3D"${test-war.dir}/${app.name}-${app.version}.war" fork=3D"yes" failureproperty=3D"tests.failed" haltonerror=3D"true"> =09=09=09<!-- Configure the cactus task for logging --> =09=09=09<cactusproperty server=3D"false" =09=09=09=09propertiesFile=3D"${meta.dir}/${configtype}/test/logging_client= .properties"/> =09=09=09<cactusproperty server=3D"true" =09=09=09=09propertiesFile=3D"${meta.dir}/${configtype}/test/logging_server= .properties"/> =09=09=09<!-- Additional jars that will be added to the classpath used to s= tart the =09=09=09=09 container (in addition to the container jars themseleves which= are =09=09=09=09 automatically added by the <cactus> task --> =09=09=09<containerclasspath> =09=09=09=09<pathelement path=3D"${test-props.dir}"/> =09=09=09</containerclasspath> =09=09=09 =09=09=09<classpath> =09=09=09=09<pathelement path=3D"${instrumented.classes}"/> =09=09=09=09<pathelement path=3D"${classes.dir}"/> =09=09=09=09<pathelement location=3D"${test-lib.dir}/my-tests.jar"/> =09=09=09=09<path refid=3D"project.classpath"/> =09=09=09</classpath> =09 =09=09=09<containerset> =09=09=09=09<tomcat4x if=3D"tomcat-dist.dir" =09=09=09=09=09=09 dir=3D"${tomcat-dist.dir}" port=3D"${test.port}" =09=09=09=09=09=09 output=3D"${test.results}/tomcat4x.out" =09=09=09=09=09=09 todir=3D"${test.results}/tomcat4x" =09=09=09=09=09=09 tmpdir=3D"${test.temp.dir}" =09=09=09=09=09=09 jvmArgs=3D"-DGG_HOME=3DC:/test"/> =09=09=09</containerset> =09=09=09<formatter type=3D"brief" usefile=3D"false"/> =09=09=09<formatter type=3D"xml"/> =09=09=09<batchtest> =09=09=09=09<fileset dir=3D"${testsrc.dir}"> =09=09=09=09=09<include name=3D"**/Test*.java"/> =09=09=09=09=09<exclude name=3D"**/Test*All.java"/> =09=09=09=09</fileset> =09=09=09</batchtest> =09=09</cactus> <!-- Generate the JUnit reports --> =20 =09=09<junitreport todir=3D"${test.results}/tomcat4x"> =09=09=09<fileset dir=3D"${test.results}/tomcat4x" =09=09=09=09=09 includes=3D"TEST-*.xml"/> =09=09=09<report todir=3D"${test.results}/tomcat4x" =09=09=09=09=09format=3D"frames"/> =09=09</junitreport> =09=09<fail if=3D"tests.failed">At least one test failed!</fail> =09</target> <target name=3D"coverage" description=3D"HTML coverage reports can be found in build/coverage"> =09 =20 =09=09<mkdir dir=3D"${test.results}/coverage"/> =09=09<cobertura-report srcdir=3D"${src.dir}" destdir=3D"${test.results}/coverage" datafile=3D"${test.dir}/cobertura.ser"/> =09=09<echo> =09=09=09Cobertura reports have been generated. =09=09=09The HTML report is ${test.results}/coverage/index.html =09=09</echo> </target> I'm getting 0% coverage for all tests. Is there a way to see if the classes have been instrumented? |