Monday, June 2, 2008

    Cobertura - Test Coverage Tool

    Many a times we wonder that why a software failed even when we have got everything insured with unit tests. Or some times the situation are when we are not exactly sure why the software is not working the way we want it too even though all the tests are passed. If you have gone through similar situations and looking for an answer, this is it.


    Cobertura is a versatile Java unit test coverage (This blog is about J2EE right) tool. It is a profilic tool that calculates line by line coverage and branch coverage along side other useful metrics like McCabe Complexity Number etc. But the most important idea is that you can see whether your tests are executing your code at each line or not. This becomes very important at the time when you are debugging the unknown error or securing your code for future moderation sensitivity. In any case nothing better than a FREE TOOL. Yes you heard me right its Free. You can download the same from here http://cobertura.sourceforge.net/. If you find any dificullty in installing the same for your project, feel free to write to me.


    If you are an advance user and already knows about cobertura than there are chances that you probably might also knows about Clover (Paid Tool Not Good ) http://www.atlassian.com/software/clover. Price is very high but the dashboard they provide is execellent.


    So don't be disappointed if you cannot purchase the same, as in the near future I will be updating my own xsl sheet which can generate similar report for you without fuss. And yes that will be absolutely FREE, you can donate some bugs for my beer if you wish. But that xsl is free no questions asked :)


    By the way, this is what Cobertura reports looks like this:


    While my xsl will process the output and provide a report like this:


     

    Site Info

    Text

    Java 2 Enterprise Edition Copyright © 2009 Community is Designed by Bie