logoalt Hacker News

mlsu • today at 7:03 PM • 0 replies • view on HN

There's a nice symmetry between code and tests that is very under appreciated.

'Good code' is abstracted well, organized around underlying structure of the problem, extensible, maintainable, well named and organized. I think most people's conception of a 'good test suite' is that the coverage is very high, 100% and MC/DC and all that. That's not really what a good test suite is though. A good test suite is just like good code: abstracted well, organized around underlying structure of the problem... It is a mirror.

In the absolute ideal case, with a good test suite, one could reconstruct good code. And with a good codebase, one could write a good test suite. They are perfect mirrors of one another. In practice, if you have a 100% lcov test suite, typically all you can manage to do is recreate the exact structure of the existing code, bugs and all. This is what you are saying here and I absolutely agree.

LLM's make this far worse, imho. People use LLM's to write unit tests. Great, more code coverage!