Test Please

Testing is a very contentious subject.  Some people hate it with a vengeance, thinking it is a waste of time for engineers to write and conduct tests.  Others think of it as a religious requirement, TDD (test driven design) is their Messiah.  There are dozens of different test frameworks per stack and several types of testing to conduct.  With that in mind, imagine how hard it is to effectively test software.

Pardon me being so opinionated, but you need automated unit testing.  I am not the greatest at writing unit tests and having enough coverage (as anyone who has worked with me knows) but there are obvious benefits.  The definition of testing is  … to make sure something works.  So why would you not want to make sure something works?  Writing tests also makes you think through different edge cases that you probably would not have normally during development.  It helps prevent future code changes from breaking working functionality, AKA regression testing.  Regression testing is probably my favourite reason for writing tests because it is so easy to break a system when trying to add a new feature, especially if you didn’t write the original code.  Some say that tests document the code, I don’t really buy that because I’ve never looked at tests to understand code but I am not everyone.

While automated testing is great, sometimes I feel like it is a crutch.  Just because you wrote some unit tests doesn’t mean that your code will work as planned.  I find that people rarely actually try out the software they write as an end user.  You add a new endpoint or field to your API you should actually try curling it.  Or maybe you add a new zoom feature to your website, you should try zooming in and out.  Try out a real user flow to make sure that not only the specific feature you built work but it works as the users will use it.  And if you can automate integration and behavioral tests you definitely should in order to prevent regressions.

Write tests, I know it is a pain in the butt however it is worth it in the long run.  You don’t want your code breaking at 3am costing the company money.  Some tests are better than none.  Lots of tests are better than some.  But make sure you actually try out your software.  Be a client, you might learn something.

Good Luck,
-Larry

Advertisements