Java Chatter and Random Nagging

Thursday, February 22, 2007

Unit Testing : Path coverage

This interesting article just crossed my eyes, discussing unit testing strategies and its relation with code coverage. In the article, the authors discuss problems with statement coverage and branch coverage by using a simple example. Both techniques are well known and metric tools exist but apparently do provide a false sense of security, even when they are at 100%.

The Path Coverage technique the authors presents is based on the algebraic concept of a basis set of linear independent paths. It requires a lot more of reasoning from the programmer, even in the very basic example the authors present. Injecting data to force execution down a specific path is difficult in a real world application, and when you have to do this for every path of the basis set, it would require a lot of effort and time.

In my opinion, 100% path coverage is only worth the effort for very critical, isolated methods.

0 Comments:

Post a Comment

<< Home