Skip to main content

To test or not to test

I seem to answer this question over and over.

How much effort should be put into unit testing.

And my answer is always the same.

You should write the test if the test has a higher value than the cost of writing it.

Now, this depends on the developer, how good he is at writing automatic tests. This might not be true for any of the tests of a novice unit tester. Then again, it is a investment - learning to unit test.

The novice tester would follow up with the question, "How do I know that the test will be worth more than the effort producing it?". 20% of the tests that you write will count up for 80% of the value. Just focus on the right 20%.

This rule can be made general

You should not do task X if the value of X does not exceed the effort of doing it.

comments powered by Disqus