Blog

Test Debt

I’ve finally found some time to write about the last category of technical debt in my technical debt categories series. So let’s take a look!

What Is Test Debt?

The authors of Towards an Ontology of Terms on Technical Debt define test debt as:

issues found in testing activities which can affect the quality of testing activities.

The paper also contains some examples:

  • planned tests that were not run
  • low code coverage
  • incomplete tests

We previously covered test automation debt. At first glance it may seem we’re venturing in the same category here. But there is a subtle difference.

Test automation is about automated tests. But while I’m a big proponent of test automation, testing software is about more than automated tests. Inevitably we test manually as well. So test debt is broader than just test automation debt.

Because test debt doesn’t specify whether or not the tests are automated, we can find test debt in our automated tests as well. Regardless of whether the tests are run in an automated way or manually, our test suite may be incomplete or we may not always run the necessary tests.

Causes Of Test Debt

In my experience, test debt often occurs due to a combination of wanting to speed up development (“we have not time for extensive testing”), overconfidence (“I’m pretty sure this code works”) and basically not liking the practice of software testing (“testing is boring, I want to write code”).

Let’s look at each of these separately.

Again, schedule pressure is a cause of technical debt. Whether pushed onto engineering teams externally (i.e. by managers) or internally (by themselves), teams can often incur test debt because they feel the need to quickly move on to the next task. Testing feels like a waste of precious time. Yet, if the time between finishing the feature and actually using the feature is too large (and we’re talking days here, not weeks), the developer risks having to repeat parts of the software development process again. If a bug arises, they may have to read the requirements again, read the code, and test their bugfix.

Overconfidence is something most developers suffer from. It’s not necessarily bad, but we must remain vigilant of our overconfidence. Instead of being confident that our code works, it’s best we prove it to ourselves with decent testing.

Finally, most developers don’t get all excited about testing, even if tests are written in code. They want to implement features, solve user’s problems, design user interfaces. Even several decades after Extreme Programming popularized the idea of automated tests, I still find myself having to convince teams to invest time in writing tests.

Solving Test Debt

In order to start solving test debt, we need to change our mindset. And this includes all stakeholders in the software development process.

Managers must leave room for developers to invest in testing. In fact, they must expect their teams to do so. Personally, I’m not a fan of separate QA teams, because this often removes the responsibility for quality away from developers, even if this wasn’t the intention.

Team leads should mentor their team members on how (and why) to test. This can be a challenge, especially when faced with skepticism or a lack of enthusiasm. Making testing an obligation without team buy-in can be counter-productive over time.

Finally, developers should take responsibility to test the code they write. Being a software engineer is more than churning out code. If they feel external or internal pressure to go over the testing process (too) quickly, it’s their responsibility to resist this pressure.

The Business Case For Reducing Test Debt

Incomplete testing inevitably leads to regression in software. Any software project becomes complex very fast. Too complex to be able to have a complete mental picture of all the moving parts. And when we modify something in one place, something will break somewhere else.

A decent test suite will reduce this risk significantly (yet not remove the risk completely). And while we’re at it, this test suite should be almost completely automated.

This saves time, and reduces opportunity costs because developers have more time to take on other tasks like implementing new features.

The increased stability of the software means happier customers, which should lead to a better financial result.

Leave a Reply

Your email address will not be published. Required fields are marked *