There are several ways to improve your skills as a developer (e.g. “Try This For a Week And Speed Up Your Coding Productivity 10x” ). In this article, I describe why one of the best ways to do this is to improve your testing skills. Therefore, I’m giving you three specific reasons that show you why you should start working on your unit tests tomorrow 😉
- Thinking of what is desired, instead of what is possible. As developers, we want to create cool stuff. We want to showcase our technical skills in every project, maybe also learning something new from. Therefore, our focus is usually on stretching the limits to what is possible. However, what we came up with when doing so, is often not what is desired by the customer, who simply wants to have a working piece of software. By writing tests, we are forced to reflect on what we actually want to do (the “expected result” of a test case). This way, we become more focused on the aspects of the software that provide benefits to our customer (instead of showcasing our awesome coding skills).
- Learn to document your thoughts. As developers, we usually start writing code as soon as we have an idea in our minds. This way, only after days of hard work, we find out that we actually. By bringing our ideas from our head to paper (e.g. in the form of test case specifications or unit tests), we automatically have to think things through before spending days on making it work. In this end, this can help days. An added benefit is that documentation (also in the form of test cases, if you stick to some conventions, as described here “3 easy fixes for perfect unit test code” ) can also be used by others to better understand our code and pick it up to make further improvements.
- Gain confidence into your code. After some time of working on a project (or picking it up after a longer break), there is usually a state in which adding new or changing existing functionality becomes a real pain. You are afraid of changing too much at once, because you are not sure about the consequences. One single change could break the whole system. Even worse: you might not realize some of the things that broke due to your change. But one thing is sure: your users will notice 😉 However, when having a sufficient amount of meaningful unit tests, this should not be a problem any more. After every change, you realize the parts that you broke by having a look at the failing unit tests. By making all tests pass again, you gain the confidence into the correctness of your adaptation. By testing the added functionality, you also gain confidence into your changes, and can ship the newly developed software without hesitation!
Let me know what you think about testing in general, and these three aspects in particular, in the comments section below!
Business vector created by vectorjuice – www.freepik.com
Daniel Lehner