Hi Reto, I understood your point of view but to me the problem I'm talking about could be "easily" solved for a better branch coverage and know what is the real missed branches report.
Benoît. -----Message d'origine----- De : Reto Hablützel [mailto:ret...@rethab.ch] Envoyé : mercredi 12 février 2014 21:47 À : Maven Users List Objet : Re: Code coverage with debug logs: 100% branch coverage not possible?... To follow up on Paul's answer, I would go as far as to say that I test my code in order to feel comfortable that it actually does what it should do. Thus, I can very well live with 90% coverage if I know what the missing 10% are rather than testing for the sake of making a good impression with a 100% report. - Reto On Feb 12, 2014 9:37 PM, "Paul Benedict" <pbened...@apache.org> wrote: > IIRC, there should be an option in Emma/Cobertura that allows you to > exclude coverage on certain classes. So if you can exclude your log4j > classes (you don't really want to test your logging, do you?), then > you should be able to raise your percentage. > > > On Wed, Feb 12, 2014 at 2:30 PM, Benoît Berthonneau > <ben...@berthonneau.com>wrote: > > > Hi all, > > > > > > > > I need your opinion/way to tackle the following problem: > > > > In many projects we use a Logger (doesn't matter which implementation). > It > > is often recommend to test if the debug level is activated before > logging a > > debug trace like the following: > > > > if (logger.isDebugEnabled()) { > > > > logger.debug("blah " + i + " in the loop that contains " + max); > > > > } > > > > > > > > Now when you run unit tests on this kind of code you need to make a > choice: > > run tests with INFO level or run tests with ALL traces activated. I > choose > > the second option in order to: > > > > * Check that debug traces doesn't throw unwanted exception (like > > NPE) > > > > * Have a better code coverage in term of covered lines > > > > > > > > But in term of branches coverage we could never have a 100% :( > > > > > > > > To me the only way to cover this is to run the tests suite 2 times: > > one with INFO traces configured, and another one with ALL traces > > activated. > > > > Did you face this issue and how did you solve it ? > > > > > > > > Thanks, > > > > Benoît. > > > > > > > -- > Cheers, > Paul > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org