Re: Unit test coverage

From: Holger Hoffstätte (holge..izards.de)
Date: Sun May 08 2005 - 14:12:48 EDT

  • Next message: Andrus Adamchik: "Re: Unit test coverage"

    As promised, initial support for JUnit test coverage analysis is now in
    CVS. I used emma (http://emma.sourceforge.net/) and as Mike said it was
    really easy..once I figured out how not to mess up the quite historically
    grown build file. ;)

    Here's how it works:

    - the toplevel build.xml has a new target "testcoverage", which simply
    sets a coverage-enabling property and then starts the regular "test"
    target. I figured this was an easy way to run the instrumentation only
    when needed.

    - the test target in build-tests.xml now simply calls <emmajava> instead
    of <java>. When the coverage-enabling property is disabled, no magic will
    happen - it's essentially just a wrapper around the <java> task and
    behaves just like it, with no side effects. If the property is enabled,
    all classes matched by a filter will be instrumented and run. After the
    task has finished, a HTML report is generated in
    build/test/coverage/<connection>/. That's all!

    Andrus, please give it a try and let me know if it works. Right now only
    the main cayenne tests are analysed, so if we're happy with the results
    the other ant files can easily be adapted as well.
    Mike, please have a look too and tell me how many boneheaded newbie
    mistakes I made. :)

    Holger



    This archive was generated by hypermail 2.0.0 : Sun May 08 2005 - 14:12:51 EDT