Think about your ‘Cyclomatic Complexity’

If you have asked yourself: When can you safely say you’re done writing unit tests. The answer lies in the ‘Cyclomatic Complexity’ of your code.

When you have written tests that exercise each possible path through your code, you are having a code coverage of 100%. For your unit-testing efforts this means: you’re done.

Thinking about your code in terms of ‘Cyclomatic Complexity’ as you write it may help you write more testable code.

A simple explanation: