Software Reuse Quick Tip #25

April 14, 2010

Tip #25 – Leverage Code Coverage Tools

Code coverage tools help with defect detection and prevention as part of continuous integration. I emphasized the importance of automated tests with regard to resuable assets – code coverage is no less important.

Code coverage reporting provides a window into the health of your codebase.

  • the depth of your automated tests – what percentage of code is being executed by the tests?
  • are there unused blocks of code – including functions, even classes – that are not executed?
  • they are invaluable in helping detect complex code – are some classes too bulky/ripe for refactoring? Code coverage will make these painfully obvious to the developer.

Code coverage thus not only helps you identify opportunities for better tests it also helps you eliminate dead/bloated code and rip apart code that is too complex. I wrote earlier post on developing reusable assets for use first – I recommend identifying extensions/flexibility on a as-needed basis for reusable asset evolution. Code coverage will point out areas for achieving this objective as well.

Getting started is very simply – ff you are using apache maven2 for instance in the java world, it is extremely simple to set these up and use them by adding a few entires to the pom.xml file. Below is the plugin declaration for Cobertura – for plugin’s full usage instructions go here.



You can run code coverage by simply executing: mvn cobertura:cobertura from the project root folder- this will generate instrumented java classes, execute automated unit tests, and produce a code and branch coverage report.

Overcoming Technical Challenges With Adopting Agile – New Article

November 14, 2009

infoq Article on overcoming technical challenges with adopting agile methods was recently published at – do check it out here: .

The article covers:

  • setting up developer environments
  • automated testing & continuous integration
  • Defining the meaning of “done” in your environment.

Software Reuse Quick Tip #9

April 30, 2009

Tip #9 Create reusable scripts to achieve continuous integration
You can create reusable scripts for compiling, executing, and reporting all your unit and regression tests. This is applicable whether you are building components or services or even business process flows within the context of a SOA architecture. The next logical thing to do would be to integrate these scripts with a continuous integration suite. Below is a presentation on achieving continuous integration using a reusable set of scripts. Although this presentation is for a Service Oriented Architecture (SOA) platform based on the Tibco suite the reusable scripts can be leveraged for many other projects.

Like this post? Subscribe to RSS feed or get blog updates via email.

add to Digg it : post to facebook: Stumble It! : :

%d bloggers like this: