Don’t Trust Tests

Unless you have seen they fail first.

David Rodenas PhD
5 min readFeb 18, 2023
Does failing tests have any value?

I first noticed it some time ago. I was reviewing the Robert C. Martin Bowling Game Kata and translating it to JavaScript, and I found myself adding one last slide to make sure that the final test case would fail. And, although I do not consider myself more expert in software development than Robert C. Martin, I felt it completely necessary,

So, let me explain. The Robert C. Martin wrote the Bowling Game Kata to teach TDD and software design. Do not take me wrong, this Kata is an excellent exercise. The methodology behind is really simple to follow: you copy literally each step that he does. It is not like other typical “katas” where you solve a problem; it is not; instead, it mimics real-life Japanese kata: you do a choreography. The idea is to learn by copy, because each step has a profound meaning, you progressively absorb all these “sense” unconsciously. So, step by step, and repetition by repetition, you absorb all the expert knowledge that it embodies. Yet, I changed the last step.

It turns out that in the last step of the kata, we add the fifth and final test. While the other tests required countless steps of fixes and refactors, the last one passes directly without any additional steps. And for some reason, having a test passing directly without failing first, made me nervous.

--

--

David Rodenas PhD

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.