Check your coverage.

Test all conditions.


It’s not hard to understand how having a codebase covered by only a few tests is much weaker than having a lot more coverage. And, of course, having no tests is the worst thing of all. So, one can extrapolate from here that having 100% code coverage would be best of all.

Getting there can be a bit of a game. Practicing TDD should lead to 100% coverage. There are tools available to measure the coverage and locate sections of code that don’t have tests.

The game doesn’t stop there. Having 100% coverage does not mean you have handled all conditions. Sometimes the outputs of a routine may exhibit different behavior in various situations.

When writing your examples, try to look for nulls, exceptions, and boundary conditions. Be sure to borrow from real-world examples. Try to imagine how the system may perform when users do strange things. And indeed, if any defects are reported, make sure everything around their cases gets covered as well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: