How and why I write tests

Posted by Jonas Sandström on Mon 01 February 2021

I love tests. Not to write them but once I have some tests written It helps tremendously with maintaining readable and less buggy code.

The thing is, no matter what language I'm coding in, if I think to myself "How can this functionallity be tested" I unconsciously start to divide my code into smaller isolated entities. This habit was something I picked up while working as a consultant at Semcon. And since then it has proven to be a great way for me (and people I work with) to develop applications and scripts that are both good for avoiding bugs and also get back to after a couple of months.

For Python testing I highly recomend using pytest, Python Testing with pytest is a great book if you want to dig into the best practices of using this library. For JavasSript I like the testrunner Jest.