The challenge

A legacy codebase had 16% unit test coverage, and nobody wanted to refactor it. Without tests, no one could say what a change might break.

That created a deadlock. Modernisation needed test coverage, and writing that coverage by hand for a codebase this size was estimated at 50 developers for nine to twelve months.

At that cost the work never won approval. Each quarter the codebase grew more expensive to change and to keep running.

Our approach

We used GenAI to read the existing code and write the test suite, which changed the economics of the deadlock. The tools parse the legacy code, infer its intended behaviour and generate tests for it.

Engineers reviewed every generated test before accepting it. A test that locks in a bug as correct behaviour is worse than no test, so the engineers spent their time checking tests. Six engineers completed the work in a week and a half.

What we built

We set up a GenAI test generation pipeline for the legacy codebase, with engineers reviewing every generated test. The final suite runs in the existing CI/CD pipeline.

Head of Engineeringenterprise software estate
“We were looking at fifty developers for a year. They did it with six engineers in two weeks, and the tests cover every release now.”

Outcome

  • 16% to 85% unit test coverage of the legacy codebase.

  • 6 engineers, 1.5 weeks against a manual estimate of 50 developers for nine to twelve months.

  • $400K to $500K estimated cost avoided against the manual approach.

Team

Senior Partner
Nilesh Nalnikar
Engagement Senior Partner
Hannan Hakim
Principal Software Engineer
Dhanashree
Senior Project Management & Operations
Chinmay C
Engagement Director
Rima

Our learnings

  1. 01

    Generate the tests, then review them. A generated test that accepts a bug does harm.

  2. 02

    The deadlock was about cost. Once the cost fell, the work was approved.

  3. 03

    Coverage had to come first, because modernisation could not start without it.

  4. 04

    With GenAI drafting the tests, six engineers who knew the domain did the work estimated for fifty.