Last week, a pull request went around my feed with the scariest diff I have ever seen: +166 lines, โ811,883 lines. A startup had deleted all of its unit tests in one go, and the replies cheered like it was a product launch.
I got shivers and asked LinkedIn one question: would we remove all the unit tests in our repo?
I expected a handful of answers. Five days later, the post had reached about 98,000 people and collected 201 comments from engineers in trading systems, game studios, aerospace and tiny startups. I read every single one. The thread split into four camps, and each camp taught me something new.
A quick game before we start: as we go through the four camps, pick the one that sounds most like our own team. At the end, I'll ask for the number.
Camp 1: The seatbelt crew
Motto: keep every test, because everything is connected.
Most people joined this camp, and the most-liked comment made the case in one picture. A team builds a thousand features over four years, then releases feature number 1,001. Every feature leans on the others, so the team needs a way to prove the first thousand still work. Automated tests give them that proof in minutes.
Other people in this camp added two points I keep thinking about:
- Tests keep agents honest. One engineer described agent logs where the agent writes code, runs a smoke test, sees something broken, and fixes it right away. The tests pull the agent back to reality.
- Tests are documentation. Several people said a good test suite is the most reliable description of what the code should do, business rules included. I agree with this one completely.
Camp 2: The dictionary people
Motto: define "unit" first, then we can talk.
This camp had the sharpest answers. Their point: a "unit" can mean a method, a class, or a behaviour.
When the unit is a method with every neighbour mocked, the test pins down implementation details. Each refactor breaks it, and it rarely catches a real bug. When the unit is a behaviour, the test only changes when the behaviour changes, and that is exactly the test we want to keep.
Two classic reads came up more than once: Kent C. Dodds on testing implementation details and Martin Fowler's note on unit tests, including solitary and sociable tests.
Camp 3: The pyramid climbers
Motto: move the weight up to integration tests.
A big group said the industry started this shift years ago, long before agents. They described a move from the classic testing pyramid to a "trophy" (Kent C. Dodds' name for it) with integration tests in the middle.
Their reasons: integration tests check what users and other systems see, they survive refactors, and tools like test containers made them much faster to run. A few people also recommended property-based tests, which let one test check thousands of generated inputs.
My one pushback, which I also wrote in the thread: integration and end-to-end tests get expensive in CI once we try to cover every edge case with them. A good unit test around a tricky function is still the cheapest place to catch that edge case. I have seen unit tests fail when an AI-written function forgot an edge case, and I was very glad they were there.
Camp 4: The careful gardeners
Motto: trim the suite one test at a time.
This camp gave me the most practical takeaways, because people shared real methods for trimming a test suite safely:
- Run mutation testing first. Tools like Stryker and PIT change the code on purpose and check which tests notice. A test that misses every change is a safe candidate for deletion.
- Track which tests ever fail. One engineer suggested watching tests across months of local runs and CI. Tests that stay green while many people change the code around them guard very little.
- Review deletions like code. Delete one test at a time, with a reason each time: a duplicate, a code branch the team already removed, a workaround for a bug that is now fixed.
- Write the specs first. One commenter pointed out that a team removing tests needs detailed specs to replace them, so the honest pull request would look more like +500,000 lines of specs and โ811,883 lines of tests.
- Keep the key invariants out of the agent's reach. Behaviour contracts and edge-case checks live outside the agent's write path, so a human signs off on every change to them.
Where I stand now
I still think deleting every unit test in one go is a gamble, and I would lose sleep over it in production. ๐ Bloated, mock-heavy test suites are a real problem, and the thread convinced me that many teams carry tests that guard very little.
So my answer is to trim the suite like we refactor code: step by step, with a reason for every deletion and a check that something still guards the behaviour. The tests that document business logic and catch real regressions stay.
The best surprise was the tone. Hundreds of people disagreed strongly, stayed kind, and shared what works for their teams. That is my favourite kind of internet.
Pick a camp
So, which camp is our team in: 1, 2, 3 or 4? Mixing camps counts, and camp 5 is officially open for business. Drop the number in the comments with one line about why.
Bonus points for a war story: has anyone here already deleted a big chunk of tests, and how did it go a few months later? ๐งช
Top comments (0)