Test early, test often! Test early, test often! If you’ve ever attended a Software Engineering 101 class you will have heard this phrase drilled into your brain. Why? Because the earlier and more often you do your software testing, the less bugs persist in your code through to production.
Of course, simply saying something isn’t going to will it into existence. And how exactly do you start testing when you’ve hardly had a line of code written?
With clever software design: that is, knowing what a unit of code will do, and defining your inputs and outputs. Then you’re off to a flying start with the ‘test early, test often’ mantra.
The dangers of not testing early and thoroughly
In some cases, not testing early and thoroughly can have fatal consequences. The Boeing 737 Max is a recent example of where not testing a system thoroughly can have this sort of outcome. In 2018 and 2019, two of these planes crashed, killing 346 people. The issue was due to a software component, MCAS (Maneuvering Characteristics Augmentation System), triggering erroneously, sending the planes into a nose dive. As the pilots did not know what had happened, this meant that they did not know how to fix the issue.
This issue has been found to be three-fold. A software component triggering when it shouldn’t (which should be able to be identified in thorough software testing), incomplete flight manual documentation, and insufficient pilot training (human-machine interface - HMI - testing in simulators) to be able to handle unknown situations.
With sufficient systems testing and HMI testing, these tragedies could potentially have been avoided.
Why test early?
Let’s put it into some terms that will be easier to understand. Let’s think of building a software project like building a house. Many components go together to build a house. If you build a house the wrong way then it may be unsafe, have a sloping floor, or wind up being incomplete because you run out of money.
The architect of a house is there to make sure the design is right; the engineer is there to build it properly - much like in software development.
Now, to build a house, we must know, for example, how much weight a particular support can hold. This support has been built to spec and tested, so we already know how much it can hold. This is like a single unit of code. We know it works, because it’s built to spec and already tested.
If, instead, we simply guess how much weight the support will hold, we may find the house falling down later, as we guessed wrong.
When building our house foundations, we want to constantly check with our spirit level that everything is level to the ground, every time we add something new, so we know that our house won’t be sloping. This is continuous testing and is something that we do after adding each new bit of code to our project.
Test early: Test driven development
One technique that satisfies the test early part of the equation is starting with test driven development aka test driven design.
Test driven development starts with turning software requirements into test cases, coding up the test cases, and then the actual code itself written later to pass each test case. While this may sound like a tedious way of doing things, it ensures that the software is built to requirements.
There are also plenty of software frameworks that automate test creation and build-out, such as Selenium for web development, or Robot for Python development. This makes test driven development much faster and easier for developers.
Test often: Continuous testing
The test often part of the saying is satisfied by what’s known as continuous testing. Continuous testing is part of the Agile/DevOps development paradigm and involves automated testing at each part of the software design, development, and delivery process.
What this means in practice is things like running unit tests after design and development (and with code changes), regression testing the entire project after each push to the code repository, and testing non-functional requirements such as performance and security after each change too.
CodeFirst builds software that’s tested thoroughly
At CodeFirst, we know the benefits of testing early and testing often - a better quality software product. A better quality software product makes for happier clients and users with less bugs in the code. If you are interested in learning more about how our developers can build your software, augment your current team, or update an old application, then get in touch with us now .