I searched the list.
I found this thread.
http://www.mail-archive.com/cactus-user%40jakarta.apache.org/msg06693.ht
ml

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}. -->
    
                <cobertura-instrument
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"/>
                        </fileset>
                </cobertura-instrument>

</target>



<target name="test" depends="prepare.test.package" description="Run the
tests on the defined container">
                <!-- Run the tests -->
                <mkdir dir="${test.results}/tomcat4x"/>
                <cactus
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"
        
propertiesFile="${meta.dir}/${configtype}/test/logging_client.properties
"/>
                        <cactusproperty server="true"
        
propertiesFile="${meta.dir}/${configtype}/test/logging_server.properties
"/>

                        <!-- 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 -->
                        <containerclasspath>
                                <pathelement path="${test-props.dir}"/>
                        </containerclasspath>
                        

                        <classpath>
                                <pathelement
path="${instrumented.classes}"/>
                                <pathelement path="${classes.dir}"/>
                                <pathelement
location="${test-lib.dir}/my-tests.jar"/>
                                <path refid="project.classpath"/>
                        </classpath>
        

                        <containerset>
                                <tomcat4x if="tomcat-dist.dir"
        
dir="${tomcat-dist.dir}" port="${test.port}"
        
output="${test.results}/tomcat4x.out"
        
todir="${test.results}/tomcat4x"
        
tmpdir="${test.temp.dir}"
        
jvmArgs="-DGG_HOME=C:/test"/>
                        </containerset>

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

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

                </cactus>

                <!-- Generate the JUnit reports -->
    
                <junitreport todir="${test.results}/tomcat4x">
                        <fileset dir="${test.results}/tomcat4x"
                                         includes="TEST-*.xml"/>
                        <report todir="${test.results}/tomcat4x"
                                        format="frames"/>
                </junitreport>

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

        </target>


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

                <echo>
                        Cobertura reports have been generated.
                        The HTML report is
${test.results}/coverage/index.html
                </echo>

    </target>

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 any.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to