Very simple rule of thumb on when to write tests
Mirek Sedzinski
Posted on January 1, 2021
Testing is a critical part of software development process. And there is a ton of literature on when and how to test.
I'm not a big fun of sticking to any particular approach just because it's currently popular.
Over the course of time I found a simple way to identify potential candidate for tests in my code:
As I write a piece of the code, very often, I start to feel uncertain whether it will work or not. This feeling is accompanied by the urge to execute the code and validate its behaviour at runtime.
Well, this for me is a strong indicator that I should write tests.
Having said that, please mind that I'm talking about potential candidate. Sometimes (rarely), on second thought, I come to conclusion that no tests are needed.
Posted on January 1, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.