CC Open Source Blog

Well Covered

gravatar

by nathan on 2010-10-05

When we rolled out Hudson for CC code last month, I already knew that I wanted to have test coverage reporting. There's simply no reason not to: it provides a way to understand how complete your tests are, and when combined with branch testing, gives you an easy way to figure out what tests need to be written (or where to target your test writing efforts).

Last week I updated DiscoverEd to use Cobertura for coverage. It was pretty easy to crib the example ant build file to add support for instrumenting and testing our code.

When I first tried to add coverage support to our Python code, I encountered an issue between coverage and Jinja2. Ned quickly committed a fix, and today I finished instrumenting our core Python projects for coverage reporting. This includes the license engine (cc.engine), the API (cc.api), the underlying license library (cc.license), and the structured data scraper used by the deeds (deedscraper).

A pleasant surprise after instrumenting is the current state of coverage. With the exception of cc.engine, we're at greater than 90% coverage for our core code (it appears that there are lots of branches/conditionals we don't test adequately in cc.engine right now). Looking forward to seeing 100's across the board.