×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

ANT Cobertura

ANT Cobertura

ANT Cobertura

(OP)
Hi,

I have a few different projects that i need to run code coverage on using cobertura. Im testing this on two projects at the moment. I have it so that there are different folders for each report but the problem is, the classes from both projects are appearing in both of the seperate reports.
Is there a way around this?

Thanks for the help
Dexter


CODE


<!-- ========================================================== -->
<!-- Cobetura Code Coverage                                     -->
<!-- ========================================================== -->


        <cobertura-instrument todir="${instrumented.classes.dir.OtherCar}">
            <fileset dir="${build.src.classes.dir.OtherCar}">
                <include name="**/*.class" />
                <exclude name="**/*Test*.class"/>
            </fileset>
        </cobertura-instrument>



        <cobertura-instrument todir="${instrumented.classes.dir.TestCar}">
            <fileset dir="${build.src.classes.dir.TestCar}">
                <include name="**/*.class" />
                <exclude name="**/*Test*.class"/>
            </fileset>
        </cobertura-instrument>




CODE


<!-- ========================================================== -->
<!-- JUnit Reporting - OtherCar                                    -->
<!-- ========================================================== -->

    <delete file="${root.dir}/coberturaOtherCar.ser"/>

    <target name="junit.OtherCar">
        <junit fork="yes" printsummary="yes">
            <sysproperty key="net.sourceforge.cobertura.datafile" file="${root.dir}/coberturaOtherCar.ser"/>
            <classpath location="${instrumented.classes.dir.OtherCar}"/>
            <classpath location="${build.test.classes.dir.OtherCar}"/>

            <classpath refid="cobertura.classpath"/>
            <classpath refid="test.classpath"/>


            <formatter type="xml"/>
            <batchtest fork="yes" todir="${test.reports.data.dir.OtherCar}">
                <fileset dir="${build.test.classes.dir.OtherCar}" includes="**/*Test*.class"/>
            </batchtest>
        </junit>

    <!--Create the JUnit Test Reports-->
        <junitreport todir="${test.reports.data.dir.OtherCar}">
              <fileset dir="${test.reports.data.dir.OtherCar}">
                <include name="TEST-*.xml"/>
              </fileset>
              <report format="frames" todir="${test.reports.dir.junit.OtherCar}"/>
        </junitreport>
    </target>

<!-- ========================================================== -->
<!-- Generating the Cobertura Test Report for OtherCar Module   -->
<!-- ========================================================== -->

    <cobertura-report format="html" destdir="${test.reports.dir.cobertura.OtherCar}" srcdir="${src.dir.OtherCar}"/>




<!-- ========================================================== -->
<!-- JUnit Reporting - TestCar                                    -->
<!-- ========================================================== -->
    <delete file="${root.dir}/coberturaTestCar.ser"/>
    
    <target name="junit.TestCar">
        <junit fork="yes" printsummary="yes">
            <sysproperty key="net.sourceforge.cobertura.datafile" file="${root.dir.TestCar}/coberturaTestCar.ser"/>
            <classpath location="${instrumented.classes.dir.TestCar}"/>
            <classpath location="${build.test.classes.dir.TestCar}"/>

            <classpath refid="cobertura.classpath"/>
            <classpath refid="test.classpath"/>

            <formatter type="xml"/>
            <batchtest fork="yes" todir="${test.reports.data.dir.TestCar}">
                <fileset dir="${build.test.classes.dir.TestCar}" includes="**/*Test*.class"/>
            </batchtest>
        </junit>

    <!--Create the JUnit Test Reports-->
        <junitreport todir="${test.reports.data.dir.TestCar}">
              <fileset dir="${test.reports.data.dir.TestCar}">
                <include name="TEST-*.xml"/>
              </fileset>
              <report format="frames" todir="${test.reports.dir.junit.TestCar}"/>
        </junitreport>
    </target>



<!-- ========================================================== -->
<!-- Generating the Cobertura Test Report                        -->
<!-- ========================================================== -->

    <cobertura-report format="html" destdir="${test.reports.dir.cobertura.TestCar}" srcdir="${src.dir.TestCar}"/>

RE: ANT Cobertura

(OP)
I figured out what i was missing. In the Cobertura report tag i needed to specify the .ser file i wanted to use, otherwise it creates the cobertura.ser and combines all the classes in the other .ser files and these end up in all the reports.

CODE

<cobertura-report format="html" datafile="${root.dir}/coberturaTestCar.ser" destdir="${test.reports.dir.cobertura.TestCar}" srcdir="${src.dir.TestCar}"/>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close