I have never met a single programmer who can code perfectly. I don’t think such a person exists.
Once upon a time I hated testing software. It wasn’t important to me. I didn’t see the purpose. It seemed like a huge waste of everybody’s time and money.
Throughout my career I was never taught how, or why, I should be testing my software. I made lots of excuses for not wanting to learn. I spoke to many developers who also made excuses for not wanting to learn. They still make the same excuses today. I eventually learned, they didn’t.
Throughout my time working with others I’ve came across many different opposing views to software testing (some were valid, but that’s another blog post). Below are some of the most common reasons developers don’t give software testing a chance …
I have never met a single programmer who can code perfectly. I don’t think such a person exists.
Take for example the biggest tech companies in the world. Google, Facebook, Rockstar, Sony etc. They hire the smartest developers in the world. Yet, their developers still manage to write insecure code. The proof is in the pudding folks: https://h1.sintheticlabs.com
(FWIW any web developer who leaves an XSS or SQLi vulnerability in production code needs a kick up the backside!)
My response to those who proclaim their code is perfect: How do you know your code runs perfectly. Have you tested it? Can you test it now and tell me it runs perfectly?
Test all the things! — with the exception of 3rd party code which should already come with its own tests.
I’m going to take a quote from this StackExchange answer, because it makes sense:
1. Test the common case of everything you can. This will tell you when that code breaks after you make some change (which is, in my opinion, the single greatest benefit of automated unit testing).
2. Test the edge cases of a few unusually complex code that you think will probably have errors.
3. Whenever you find a bug, write a test case to cover it before fixing it
4. Add edge-case tests to less critical code whenever someone has time to kill.
It’s difficult to know where to start when you’re new to the world of software testing. There’s many different types of software testing. I always recommend beginners start with Unit Testing, Integration Testing and Regression Testing.
There’s a whole heap of software testing methodologies. Most you will never need to use, but it’s useful to at least know the differences between the different types of software testing:
If you’d like to know more about all the different types of software testing you should check out this article.
The important thing is to make testing a necessity and not an option.
Anything is difficult if you don’t know how to do it. It takes time, practice, experience and patience. Chill out, relax, and have fun when learning. Expect initial failure and confusion. You’re only human!
Once you learn how to test and start to feel comfortable doing so you will find it’s actually pretty simple!
Grab a good book. Read documentation. Discuss with other developers on IRC/Slack/Discord etc.
This is a common misconception related to the last excuse.
Anyone new to testing will struggle initially. New lands are being explored. It feels uncomfortable. You’re human, and it’s perfectly normal.
In the early stages it will cost lots of time. Stick with it, keep learning, and eventually it will become second nature. The trick is to make it a part of your software development workflow so it becomes habit.
Writing tests saves lots of time and lots of headaches in the long run. Being able to repeat tests at the click of a button and confirm everything works as expected gives you the confidence to ship software into production. If anything should go wrong you can simply run your tests to help discover the source of the bug.
There’s a sense of fulfilment when you ship code that passes every test. Maintaining testable code is always easier, and more pleasurable, then working on a system without repeatable tests.
If you’re new to software testing, or want to learn more, I highly recommend the following books. I’ve hand picked these from my personally library. They are fantastic!
Happy Testing 😀