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.

The Plan

  1. Delete all unused code - We will enjoy that
  2. Prioritise tests for our models
  3. Prioritise tests for components
  4. Ignore controllers
  5. Ignore background jobs
  6. Check how well we are doing and rework our strategy

Tomiwa Ijaware

Not much is known about Tomiwa, however, information indicate that he is a software engineer that leans on the collective wisdom of open source giants. At night, he studies machine learning.

Lagos, Nigeria http://tomiwa.xyz

Subscribe to Tomiwa Ijaware's Blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!