Ketan's Musings

Where he blogs about his eclipse musings

Code Coverage And Functional Tests

with 4 comments

I am often asked this rather perilous question:

How do I view code coverage for my functional tests?

Short answer:

Here’s how…. However, use it only for figuring out what functionality is not covered, not as a workaround for not having enough unit and integrations.

Having to use functional tests to determine percentage of code coverage is IMO a bad smell, avoid as much as possible.

Written by Ketan

August 26th, 2009 at 9:34 am

4 Responses to 'Code Coverage And Functional Tests'

Subscribe to comments with RSS or TrackBack to 'Code Coverage And Functional Tests'.

  1. And in addition to that:

    Percentage doesn’t really reflect the amount of untested/uncovered code. What are 50% in a file of 10 lines compared to 50% in a file with 1000 lines?

    Gilles

    26 Aug 09 at 1:06 pm

  2. If you want code coverage you can always use the eclemma osgi hook, but I agree use it only for what is not already tested not as a percentage.

    http://www.eclemma.org/devdoc/headless.html

    its very easy to add when creating headless builds, and the output can be imported in the eclipse IDE

    Mikkel Andersen

    26 Aug 09 at 6:29 pm

  3. Code coverage does not reflect the complexity of code. A “get my member variable” as “return m_Value;” will never break… We are using Crap4J to combine unit test coverage with code complexity. You can get an easy overview here: http://www.crap4j.org

    Jan Hoppe

    1 Sep 09 at 12:16 pm

  4. @Mikkel

    emma is maintained anymore ? I didn’t see any release or bugfixes after 2005. I was planning to shift to cobertura ?

    Jigar Shah

    30 Dec 09 at 1:17 pm

Leave a Reply

IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

What is 4 + 11 ?
Please leave these two fields as-is: