How to hack unit test coverage from 39% to 78%
Well, if you are like me and you inherited a really large convoluted codebase that gets built to a software that supports a tonne of users then you are in luck - you are not alone.
November 2014, I had a similar problem.
He who must not be named handed me a contract to seal up broken pipelines within the system using nothing but php and mysql. It was my 3rd week writing php in a production environment. What am i going to do? How do I even understand how this works? Finally, what do I do next, the whole system is crawling - This were my expressions on that day.
Fast forward 20months. We are pretty comfortable with the new codebase, support is really cool, we have on boarded two new engineers and a lot of clients and customers, we now communicate with more systems, our apis are documented and developer friendly but - Unit Test coverage is at 39%.
Unit Test coverage is at 39%
We need to up that number to something significantly greater than 70% to get a few boxes of pizza and that our conundrum. But don't fret, we have a plan.
- Delete all unused code - We will enjoy that
- Prioritise tests for our models
- Prioritise tests for components
- Ignore controllers
- Ignore background jobs
- Check how well we are doing and rework our strategy
Subscribe to Tomiwa Ijaware's Blog
Get the latest posts delivered right to your inbox