logoalt Hacker News

kragen • today at 6:59 PM • 0 replies • view on HN

Ouch. Yeah. On the experiment I'm doing today (the new filesystem described in more detail in https://news.ycombinator.com/item?id=50785404) I think two or three mutant runs per day is about right, but it only has 45 mutants. But I don't have any flakies, and the normal test run is only about 2 minutes on my laptop.

I like your idea of sending agents to critique and improve your test suite.

Mutants can be helpful for identifying useless or redundant tests, which can help with removing them. If you still have flakies, though, that suggests you haven't been spending much effort at all on improving your test suite.

The term "test oracle" can mean a lot of things, including "a constant output expected for a given constant input", which I think is worthwhile in a pretty wide range of circumstances, because that's what makes any automated testing possible at all. Using slightly more interesting test oracles can be extremely valuable for utterly decimating your test suite — a single generative test with Hypothesis or similar can very frequently replace 4–64 manual instance tests, and it's easier to understand and maintain.

As for end-to-end test suites, I think that's what you should add first if you're approaching an existing untested project. They catch many more bugs per line of test code than unit tests do, and they need much less maintenance, because refactoring never invalidates them. (If your "refactoring" changes behavior that an end-to-end test suite could detect, you fail at refactoring.) Often they run faster, too, although this can go either way.

However, end-to-end test suites don't help with bottom-up implementation; they don't speed up debugging; and they don't improve your internal system design. Unit tests can do all of these things. So often they're more valuable when you're starting a new project.