The Cool Kids Write Tests
Pan Chasinga
Posted on April 22, 2018
There is a bad stigma to software testing in general. Many developers associate it with SQA/SDET. They think they have no business writing tests, for that should be left to the goalkeepers. I even know an SQA engineer who reduced himself to not being a real engineer, and there are people who consider applying to SDET positions as easier entry into a prestigious company. These contribute to a false belief that real engineers only build stuff while those who test it are inferior.
The reality cannot be more different. In the open source world, tested code indicates quality and seriousness. Tests can be used as heuristics for the author of the code and everyone else involved. They can be the best documentation to a project and a great overview to the intent or design of a particular code. Moreover, writing test before you write any code (TDD) forcing you to think hard about writing clean, DOT functions. It also gives the author more sense of ownership than a throwaway code without a single test to back it.
I was asked before why I enjoy writing test (sometime in feigning bewilderment). I do because writing test is an act of hacking. It's a systematic hack to find the optimal solution to a problem and record it efficiently. We do this all the time! We write code, run it, go back to fix some error, run it again, and return to writing more code. Thing is we do this countless times without structuring our approach or automating it. For example, we may have fixed a bug and successfully run our code after great effort, but months later we might get ourselves into the same situation again and we will have to go at it like before--brute-force debugging--because we did not bother to write any test case to record the finding the first time. Writing tests is liberating. It's the real cool.
This is not to say we are required to write test for every function in our code or have to become obsessed with test coverage. But you should certainly not refrain from writing test because you don't have time or you want to move fast and break things. Because when things break they often take much more time and energy and make you feel terrible and enjoy coding much less.
Posted on April 22, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.