2 years ago I did some hacking on webwork/xwork to get the clover working.
But it was ANT based. But here are a few snippets might come handy.

It was capable of skipping isLogDebug statements. Anyway I guess we have some 
cobertura bits in our pom.xml that is useable.



Finding some snippets now:
  <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clover-plugin</artifactId>
                <configuration>
                    <jdk>1.5</jdk>
                    
<licenseLocation>lib/bootstrap/clover.license</licenseLocation>
                </configuration>
            </plugin>


<target name="clover.report" depends="test" description="generate coverage 
reports" unless="skip.tests">
        <clover-report>
            <current outfile="${dist.docs}/clover">
                <format type="html" filter="logDebug,logIsDebugEnabled"/>
            </current>
        </clover-report>
        <clover-log filter="logDebug,logIsDebugEnabled"/>
    </target>

    <target name="clover.historical" depends="clover.report" 
description="generate coverage historical reports"
            unless="skip.tests">
        <clover-historypoint historyDir="${build.clover}"/>

        <clover-report>
            <historical outfile="${dist.docs}/clover" 
historyDir="${build.clover}">
                <format type="html" filter="logDebug,logIsDebugEnabled"/>
            </historical>
        </clover-report>
        <clover-log filter="logDebug,logIsDebugEnabled"/>
    </target>

        <mkdir dir="${build.clover}"/>
        <clover-setup initString="${build.clover}/coverage.db">
            <statementContext name="logIsDebugEnabled" 
regexp="[\s]*if[\s]*\([\s]*(log|_log|LOG|_LOG)\.isDebugEnabled.*"/>
            <statementContext name="logDebug" 
regexp="[\s]*(log|_log|LOG|_LOG)\.debug[\s]*\(.*"/>
            <files>
                <exclude name="${src.test}/**/*.java"/>
            </files>
        </clover-setup>


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: James Strachan [mailto:[EMAIL PROTECTED] 
Sent: 22. august 2008 17:42
To: [email protected]
Subject: [SPAM] Re: code coverage reports - cobertura or clover

2008/8/22 Claus Ibsen <[EMAIL PROTECTED]>:
> Hi
>
> I was wondering if it was possible to setup the CI server to once a week or 
> so to run unit test with coverage enabled.
>
> I would love to have this auto generated once in a while to find gaps in our 
> testing and where we could improve or even prepare for @deprecated obsolete 
> code.
>
> I have run the reports locally myself some times but I tend to be busy with 
> all kind of other tickets and wiki documentation that my poor laptop can't 
> run longer unit tests at the same time ;)

Great idea!

If someone can hack the build to actually run the code coverage
reports, I can setup a nightly build to upload it to Apache.

Am thinking we keep the nightly distro running, whether tests pass or
not - then have a nightly 'site' build which runs all the tests and
includes code coverage?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to