Testing modern web apps - Part 0
Indeed, there are a few well-known benefits of covering your app with automated tests:
💚 Quality. By introducing testing practices to your development workflow, you help yourself write code of higher quality. On one hand, you aim to break the code down into smaller, testable, pieces; on another you need to understand very well how those pieces should work together. This zoom-in/zoom-out exercise helps developers deliver better solutions.
💚 Reliability. Scripted tests are resistant to human errors which are so common in manual testing. Although automated tests don’t guarantee that your app won’t have a single bug, they can reassure you that business critical features are working fine. Compare these two bugs: your car radio is broken and the car itself isn’t working. The goal of automated testing is to ensure that the car is always working.
💚 Reducing costs. Automated testing enables companies to spend less time on finding and fixing bugs and more on building and delivering value for users. Anything that can be automated, should be automated.
💚 Documentation. Similar to how good UX is the best replacement for end user documentation, your automated tests is the best spec for your code. Instead of documenting every non-obvious piece of code in a readme file or wiki, you can cover it by a couple of tests and be sure that it will stay up-to-date in future.
💚 Trust. If you’ve got some users on your website, you know how important it is to keep them happy. Users trust our apps when they give us their personal data and money, or spend their time on our website, or recommend it to a friend. When that trust is broken, it is so hard to regain. By investing in automated testing you make a huge step towards building and retaining users’ trust.
I most likely missed a dozen of other good points for this list, so please feel free to share your own reasons for writing tests. I’m sure that in the end we will get a long list of benefits. That’s why I say that automated tests are awesome.
With all these benefits in mind, why automated testing is not widely adopted in web development?
Again, there is a number of reasons for it:
🤬 Learning curve. There are plenty of tools, services, articles and books which often communicate contradictory messages about testing. It takes time to understand key concepts and to figure out that there is no one “right” way.
🤬 Unit tests are overrated. There are many tutorials and trainings which touch on basics of automated testing. Most of them don’t go far beyond a trivial unit test example. As a result, developers start associating automated testing with unit tests only. In fact, automated testing tools are much more diverse and powerful than just unit tests and it’s unfortunate that developers keep focusing on unit tests only.
🤬 Continuous Integration (CI). Please feel free to argue with me, but I strongly believe that CI setup is a prerequisite for automated testing. Sometimes it stops developers who didn’t have DevOps experience in the past. The good news is that modern CI tools are very easy to get started with. At SystemSeed, we have no sysadmins in the team because developers can configure CI without any advanced knowledge.
🤬 False economy. And last but not least, there is always an attempt to save time by not investing in automation. As I mentioned above, in fact, automated testing helps reducing costs in the long run, but at the beginning it may look like the opposite.
In these blog post series I’m going to structure and share literally everything I’ve learned about the topic since I joined SystemSeed in 2015. We will start with high level overview and then dive into specific tools and techniques which we at SystemSeed use on every day basis.
Stay tuned and remember: automated tests are awesome!