The Value of Unit Testing in Software Development

In this post we’ll explore the importance and need for unit testing in software development. While other articles focus on the practical aspects of testing, such as how to write effective test cases and how to use testing tools, we’ll approach this topic from a different perspective. We will delve into the philosophical significance of testing and share personal experiences that highlight the importance of this crucial aspect of software development.

A practical guide on how to properly write unit tests and the various tools to use is something I’ll maybe cover in another article. This is about the value of unit testing as such, and why you should make it a habit to have them.

Always think ahead

Personally, I’m not a very laid back person. I like to think things through. What I always say, and this applies to all things in my life, not just coding, is “always have a contingency plan”. If you think of all (or as many possible) outcomes a given situation may come to, then you can plan for them, and that is precious. One of my favorite quotes is “If you fail to plan, you plan to fail”. I like to sleep peacefully at nights, so I try to plan for as much as possible.

A few years ago, I worked for a company (or two) which did not write any unit tests. We, the developers just focused on writing our code, doing some manual testing and just pushing it through. Essentially the only testing that was happening was by a QA team, or by the developers themselves. This meant that tasks finished quickly, but resulted in bugs in production or if we were lucky, bugs were picked during QA testing and returned back to us for fixing.

Time saver

Now, let me clear something up. Unit testing does not replace manual developer testing. Both are equally important and time should be allocated for both of them. What unit tests do, is to diminish guess-work. This means that if something goes wrong, or a bug comes up and something isn’t working as it should, unit tests help with swiftly identifying the part of the code that has the issue. Also, by testing segments of your code as a unit, helps with identifying errors early in the development process, which saves valuable time.

Avoid code complexity

Another byproduct of not having unit tests, is bad code. Whenever a bug is fixed in the absence of unit tests, the code tends to become more complex. When you write unit tests, you are forced to think about how your code should behave in isolation. This means you have to break down your code into smaller, more manageable units, which can help avoid the creation of large, complex code blocks.

Unit tests can also help ensure that code changes do not create new complexity. Whenever a developer makes a change to the code, they can run the unit tests to ensure that the changes have not introduced any new bugs or unintended consequences. This helps ensure that the code remains simple and straightforward.

A matter of life and death

Unit testing is important for several reasons, including identifying and fixing bugs early in the development cycle, improving code quality, and increasing confidence in the software being developed. However, perhaps one of the most compelling reasons for the importance of unit testing is the potential consequences of not doing it.

The 1992 incident in London is a prime example of what can happen when software is not properly tested. In that year, London’s brand new computer-aided ambulance-dispatch system suffered a catastrophic failure due to a software error. The system was supposed to help ambulance crews respond to emergencies more efficiently, but instead, it caused chaos and confusion.

A software error caused the dispatch system to fail, resulting in long delays and increased response times for emergency calls. In some cases, patients died while waiting for an ambulance to arrive. The failure of the system had far-reaching consequences and led to public outrage and an investigation into the cause of the failure.

The cause of the failure was eventually traced back to a software error that had not been caught during testing. The failure of the ambulance dispatch system was a tragic reminder of the importance of proper testing and quality assurance in software development.

Had the software been properly tested, the error would have been identified and fixed before the system went live. The tragic consequences of the London ambulance dispatch failure highlight the critical importance of unit testing and quality assurance in software development.

This article provides more details about the incident and its aftermath, including the investigation into the cause of the failure and the lessons learned from the tragedy.


Unit testing is an essential practice in software development that should not be overlooked. It can help identify and fix bugs early in the development cycle, improve code quality, and increase confidence in the software being developed. Moreover, it can help prevent catastrophic failures like the one that occurred with London’s ambulance dispatch system in 1992.

By prioritizing unit testing, developers can ensure that the software they create is reliable, secure, and ethical, and that it meets the needs of users and society as a whole. In short, the value of unit testing in software development cannot be understated, and it is essential for creating software that is of the highest quality.

Leave a reply:

Your email address will not be published.

Site Footer