Hacker News new | ask | show | jobs
by anshumankmr 15 days ago
Honestly, the amount of bullshit unit tests Claude keeps pushing nowadays. I took a few hours the past few weeks, some with AI, some by myself to hand remove some really dumb fucking test cases. God knows how long the CI must be running when these guys push their code.
2 comments

I wonder what was it even trained on?

Who ever had the time and will to write unit tests that mock every single function/class being called, checks the strings of thrown errors, etc., for every single function, for several tests per function?

The instant you change the implementation the tests break because it's testing how many times each method has been called of an object that was passed as argument.

That's just an insane way of writing tests. But for AI that's normal for some reason.

It feels like it's making unit tests the "textbook" way that in practice you wouldn't do because in practice half the things it's testing are inconsequential.

Darn near every 100%-coverage project looks like that, in my experience. It's not always a bad thing, but there's a TON of cargo-culting of those test structures, in part because they can be applied mindlessly to reach arbitrarily high coverage.
I genuinely do believe those Github runners are being over used and frequent downtime is at least in part caused by tonnes of crappy unit tests.
Yah, and it wastes a huge amount of developer time too. This is why we have type systems, maybe use them?
Claude Code will often just test that data types, like structs or dataclasses can just have their fields read and written. It's infuriating. I don't let Claude write tests anymore without strict supervision.