Article de blogue
Tales from a coaching session: Addressing debt strategically, not upfront
5 February 2025
..but Nick. How would you address all this debt we have in our test coverage? We have like 40% code coverage. Tops. And it’s not improving.
Interesting. I also wish for it to be higher. How do you think you could improve that?
I was thinking about maybe adding a tech debt PBI to our backlog. I could estimate the R.O.I, sell it to our PO, maybe get it prioritized next quarter. It would be fun and it could really help us. What do you think?
It’s interesting. Would you be willing to explore different scenarios w/ me?
Sure….
Let’s draw up the current state of affairs.
Initial state: 40% code coverage
Let’s suppose the code coverage is evenly spread throughout the app
Given an even code coverage distribution
Suppose your initiative comes to fruition and you manage to improve coverage by 50%. That would bring it up from 40% to 60%.
Enough to bring out the champagne! 🍾
From 40% to 60%. Hurrah!
After waiting all this time, business has plenty of new ideas.
Super genius!
You start working on a new feature. You can expect the tested paths for the code affected by the new feature to be roughly ~ 60%
60%: 50% better than before.
A major improvement over your previous situation correct?
But not quite our target…. Man….How do we get out of this?
Stay with me. Here is an alternative:
You. Pay. Off. Zero. Debt. Up. Front. None. Nada.
What?! But Nick…
Wait. There’s a trick. When PO comes in w/ a new idea, you cover each small area of code you are about to change via characterization tests JUST PRIOR to working on that part of a new feature… Won’t that delay delivering the feature? Increase the estimate?
It depends. But if it does, probably not by much given the benefits of the newly added tests on preventing regressions.
Also, these may give you the required confidence to make the adequate structure changes that make the new feature easier to introduce .
Right.
Now after the introduction of the change, things look a bit like this
100% coverage from feature-focused efforts
As time goes, your code coverage map would eventually look a little something like this.
Onwards and upwards!
And this comes w/ the added benefits of not having to negotiate, plan & estimate the debt.
It also prevents the need for you to try and find a crystal ball to plan the future and what code may have to change or not.
Willing to give it a try?
Sure!