jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bret Kumler" <bkum...@goldengate.com>
Subject Cactus/Tomcat4.x & Code Coverage
Date Tue, 23 Aug 2005 18:40:10 GMT
I searched the list.
I found this thread.

I'm using http://cobertura.sourceforge.net/

It is the JCoverage replacement, since they stopped development on it.

It behaves the same way as JCoverage.

Here's my build.xml

<!-- Prepare the classes for instrumentation -->
	<target name="instrument" depends="compile" description="Add
Cobertura instrumentation">
		<!-- instrument the application classes, writing the
instrumented classes into ${instrumented.classes}. -->
datafile="${test.dir}/cobertura.ser" todir="${instrumented.classes}">
			<!-- Note that the following line causes
instrument to ignore any
			     source line containing a reference to
log4j, for the purposes
				 of coverage reporting. -->
			<ignore regex="org.apache.log4j.*"/>
			<fileset dir="${classes.dir}">
				<!-- instrument all the application
classes, but don't instrument the test classes. -->
				<include name="**/*.class"/>
				<exclude name="**/*Test.class"/>


<target name="test" depends="prepare.test.package" description="Run the
tests on the defined container">
		<!-- Run the tests -->
		<mkdir dir="${test.results}/tomcat4x"/>
warfile="${test-war.dir}/${app.name}-${app.version}.war" fork="yes"
failureproperty="tests.failed" haltonerror="true">

			<!-- Configure the cactus task for logging -->
			<cactusproperty server="false"
			<cactusproperty server="true"

			<!-- Additional jars that will be added to the
classpath used to start the
				 container (in addition to the container
jars themseleves which are
				 automatically added by the <cactus>
task -->
				<pathelement path="${test-props.dir}"/>

				<pathelement path="${classes.dir}"/>
				<path refid="project.classpath"/>

				<tomcat4x if="tomcat-dist.dir"
dir="${tomcat-dist.dir}" port="${test.port}"

			<formatter type="brief" usefile="false"/>
			<formatter type="xml"/>

				<fileset dir="${testsrc.dir}">
					<include name="**/Test*.java"/>


		<!-- Generate the JUnit reports -->
		<junitreport todir="${test.results}/tomcat4x">
			<fileset dir="${test.results}/tomcat4x"
			<report todir="${test.results}/tomcat4x"

		<fail if="tests.failed">At least one test failed!</fail>


<target name="coverage" description="HTML coverage reports can be found
in build/coverage">
		<mkdir dir="${test.results}/coverage"/>
		<cobertura-report srcdir="${src.dir}"

			Cobertura reports have been generated.
			The HTML report is


I'm getting 0% coverage.  I mailed this too the cobertura mailing list
as well.

I thought maybe I should put the instrumented classes in the container's
classpath, that was a mistake, I kept getting WEB-INT/xxxx.xml could not
be loaded.

Any ideas?

This e-mail message and any attachments may contain private, confidential, proprietary or
privileged material of GoldenGate Software, Inc. that is for the sole use of the intended
recipient(s) of this e-mail message.  Any review, copying or distribution or other use of
this e-mail message or any attachments hereto by anyone other than the intended recipient(s)
is strictly prohibited.  If you are not the intended recipient(s) of this e-mail message,
please contact GoldenGate Software, Inc. (415-777-0200) immediately and permanently delete
the original e-mail message and any copies of this e-mail message and all attachments, if

View raw message