Skip to content
publish99
All articlesAndy Nguyen

Issue 01

Uncovering tests

Our coding agents love writing tests. How much of our code do you think is tests? Take a guess, then see why we deleted 11,533 of them.

Test share of lines added to our codebase (by year)

Year

From 2021 to 2025, tests made up 3.1% of the lines we added to Karat’s main codebase.

Then we started writing code with AI agents. Before you scroll, take a guess.

Drag to guess

The models were fast at coding and relentless about verifying their work. Their preferred method? Tests.

Watch the scale on the left. The tallest bar we had in five years would barely register by July.

In October, half the lines we added were tests.

Allow me to zoom in for a moment and compare two of my pull requests this year.

In February I added a flow that let a user opt in to a different rewards program. I added 809 lines. Eight of them were tests.

In November I was standardizing how we log messages. A much smaller change. I added 288 lines, 160 of them tests.

Turns out I had company. From August on, the median pull request each month was between 55% and 58% tests.

What exactly were we testing?

We had a theory on the team that a new coding model in September had driven the jump.

Test lines almost doubled from August to September. So did the rest of the code. We’d already hit 53% in August.

Something else did change. Pick a month on the chart and look at the orange band.

In July, integration tests made up 7.6% of our test lines. In October, 17.5%.

A unit test might check that a function calculated the right amount. An integration test might also check what the next part of the system actually saved.

We’d changed how we ran those tests around the same time. Good luck untangling that from a model change.

How reliable are all these tests? I looked at what happened when a test stopped a deployment.

One failing test can stop several attempts in a row. We grouped those runs into 158 incidents. Reviewers could name the failing test in 113 of them.

How many caught a product bug?

Three. In one case a button stayed disabled when the user should have been able to continue.

Meanwhile, 71 passed again without anyone changing the code. UI timing alone accounted for 44 incidents.

This is the part I find hard to measure. If a test makes me rethink my code before I even open a pull request, where does that show up in this chart?

It’s hard to say how effective a good test was. On the other hand, it’s easy to say how ineffective some tests can be.

On November 17 we had 62,313 tests. One square each.

One pull request deleted 9,695 of them.

Some were change detectors for copy or layout. Others checked that a mock returned exactly what we’d just told it to return.

Change a button’s label and the test breaks. Disconnect the button and it might still pass.

The next day we removed 1,838 more. Duplicates and tests that couldn’t fail.

Two pull requests, 11,533 tests gone. When I read a test now, the question I keep coming back to is the one about the button. What would I have to break for this test to go red?

What counts as a test?

I counted added lines in files whose names or paths marked them as tests, specs, fixtures or end-to-end checks. I excluded generated files, bots and pull requests over 30,000 lines. The 2026 series ends November 20.

This misses some helpers. Adding those back moves the July 4 to November 20 share from 50.9% to 52.6%. A long table of inputs can contribute hundreds of lines to a single assertion. To measure coverage we’d have to look at which code actually ran.

For the deployment chart we looked at failures from June 1 through November 20. The 45 incidents we set aside included expired logs, setup failures and crashes during cleanup. A bug an engineer caught locally never gets a dot here.

Andy Nguyen

Andy builds Karat’s engineering platform. He works on billing reliability, automated testing and the tools engineers use to ship changes.

LinkedIn