jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bret Kumler" <bkum...@goldengate.com>
Subject RE: Possible to use with Cobertura?
Date Thu, 04 May 2006 16:24:58 GMT


<!-- Code Coverage lib -->
    <property name="cobertura.lib"
              value="sourceforge/cobertura-1.6/cobertura.jar" />
    <property name="asm.lib"
              value="sourceforge/cobertura-1.6/lib/asm/2.0/asm-2.0.jar"
/>
    <property name="cov-log4j.lib"
 
value="sourceforge/cobertura-1.6/lib/log4j/1.2.9/log4j-1.2.9.jar" />
    <property name="ccl.lib"
              value="sourceforge/cobertura-1.6/lib/ncss/21.41/ccl.jar"
/>
    <property name="javancss.lib"
 
value="sourceforge/cobertura-1.6/lib/ncss/21.41/javancss.jar" />
    <property name="jakarta-oro.lib"
 
value="sourceforge/cobertura-1.6/lib/oro/jakarta-oro-2.0.8.jar" />




 <!-- test code coverage classpath -->
    <path id="coverage.libs.path">
        <pathelement location="${thirdparty.dir}/${cov-log4j.lib}"/>
        <pathelement location="${thirdparty.dir}/${junit.lib}"/>
        <pathelement location="${thirdparty.dir}/${cobertura.lib}"/>
        <pathelement location="${thirdparty.dir}/${asm.lib}"/>
        <pathelement location="${thirdparty.dir}/${ccl.lib}"/>
        <pathelement location="${thirdparty.dir}/${javancss.lib}"/>
        <pathelement location="${thirdparty.dir}/${jakarta-oro.lib}"/>
    </path>



<!-- Cobertura ant task -->
    <taskdef resource="tasks.properties">
        <classpath refid="coverage.libs.path"/>
    </taskdef>


<!-- 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}">
            <ignore regex="org.apache.log4j.*"/>

            <fileset dir="${classes.dir}">
                <include name="**/*.class"/>
                <exclude name="**/*Test.class"/>
            </fileset>
        </cobertura-instrument>
    </target>


 <!-- Package up the test classes and added the test package to the war
file -->
    <target name="prepare.test" depends="compile-tests, instrument">
        <mkdir dir="${test-lib.dir}"/>
        <mkdir dir="${test-war.dir}"/>
        <mkdir dir="${test-props.dir}"/>


        <!-- Temporary hack until cobertura bug is fixed -->
        <copy todir="${tomcat-dist.dir}/common/lib"
file="${thirdparty.dir}/${cobertura.lib}"/>
        <copy todir="${tomcat-dist.dir}/common/lib"
file="${thirdparty.dir}/${asm.lib}"/>
        <copy todir="${tomcat-dist.dir}/common/lib"
file="${thirdparty.dir}/${cov-log4j.lib}"/>
        <copy todir="${tomcat-dist.dir}/common/lib"
file="${thirdparty.dir}/${ccl.lib}"/>
        <copy todir="${tomcat-dist.dir}/common/lib"
file="${thirdparty.dir}/${javancss.lib}"/>
        <copy todir="${tomcat-dist.dir}/common/lib"
file="${thirdparty.dir}/${jakarta-oro.lib}"/>


        <mkdir dir="${dist.dir}/war" />

        <war destfile="${test-war.dir}/test.war"
webxml="${web-build-meta.dir}/web.xml">
            <classes dir="${instrumented.classes}"/>
            <lib dir="${web-build-libs.dir}" />
            <zipfileset dir="${web-build.dir}">
                <exclude name="pages/**"/>
                <exclude name="WEB-INF/**"/>
            </zipfileset>
            <zipfileset dir="${web-build.dir}/pages" prefix="pages"/>
            <zipfileset dir="${web-build-meta.dir}" prefix="WEB-INF">
                <exclude name="classes/**"/>
                <exclude name="lib/**"/>
            </zipfileset>
            <zipfileset dir="${web-build-classes.dir}">
                <exclude name="com/**"/>
            </zipfileset>
        </war>


        <cactifywar srcfile="${test-war.dir}/test.war"
              destfile="${test-war.dir}/${app.name}-${app.version}.war"
 
mergewebxml="${meta.dir}/${configtype}/test/cactus-web.xml">
            <lib file="${thirdparty.dir}/${strutstest.lib}"/>
            <fileset dir="${meta.dir}/${configtype}/test"
excludes="cactus-web.xml" />
        </cactifywar>

    </target>



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

            <!-- 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}"/>
            <path refid="test-compile.libs.path"/>
            </classpath>


            <containerset>
            <tomcat4x if="tomcat-dist.dir"
                  dir="${tomcat-dist.dir}" port="${test.port}"
                  output="${test.results}/cactus.out"
                  todir="${test.results}/cactus"
                  tmpdir="${test.temp.dir}"
 
jvmArgs="-Dnet.sourceforge.cobertura.datafile=${test.dir}/cobertura.ser"
/>
            </containerset>

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

            <batchtest>
            <fileset dir="${test-classes.dir}">
                <include name="**/TestAll*.class"/>
            </fileset>
            </batchtest>

        </cactus>

        <!-- Generate the JUnit reports -->

        <junitreport todir="${test.results}/cactus">
            <fileset dir="${test.results}/cactus"
                 includes="TEST-*.xml"/>
            <report todir="${test.results}/cactus"
                format="frames"/>
        </junitreport>

    </target>



 <!-- Generate the cobertura reports -->
    <target name="coverage" depends= "test" 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>




-----Original Message-----
From: Felipe Leme [mailto:maven@felipeal.net] 
Sent: Thursday, May 04, 2006 5:01 AM
To: Cactus Users List
Subject: Re: Possible to use with Cobertura?

Hi Ryan,

BTW, once it works, it would be nice if you (or Bret) could add a
mini-howto in the wiki (for instance, in the 'Useful Code' section:
http://wiki.apache.org/jakarta-cactus/UsefulCode ).

-- Felipe

On 5/3/06, Ryan <gingrichr543@strose.edu> wrote:
> Thanks for your help, I'll try to work it out and let you know how it
> turns out.


---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org





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.


Mime
View raw message