niedziela, 14 kwietnia 2013

Enjoyment of failed tests

We usually feel bad about failed tests. No surprise, as it simply means that something got wrong or that some tests have been invalidated by the recent change to the code. But can we feel good about a failed test? I think we can and here is why.

If I add a new tests for functionality that does not exist yet, it will either not compile or will fail. Watching it is not entirely upsetting experience, because the bright side of it is that we have evidence that the newly added test get at all executed. And it is good that it got executed, this is what we expected.

Another occasion when we could look at the failing tests with a smile is just after making a "very small change that should not break anything". And after this change we see a dozen of failed tests. Imagine doing this change without unit tests at all and keeping the belief that "it couldn't have really broken anything" for the next few months.

Brak komentarzy:

Prześlij komentarz