TFA is great, but don't sleep on that awk script[0]—it really is lovely! The kind of thing that is unnecessary these days, but for these exact scenarios—group trips with shared expenses—I think everyone appreciates having things written out in a clear, easy to follow list, and this is exactly how I want to both enter information and get the results out.
I never heard of mutation testing in my very long career, until I was doing a big refactor and Fable 5.2 suggested building a custom mutation testing tool using the Go AST library. It’s a surprise when I learn something from a model, but I guess I’ll need to get used to it!
I agree with the article's premise that mutation testing is used less than it deserves. We use it in Prosody, and wrote a bit about it here: https://blog.prosody.im/mutation-testing-in-prosody/
It's very handy to have around when working on tests for new modules, etc.
> These days, nearly everyone has automated tests running in ci.
Sorry, your startup/Silicon Valley/whatever bias is showing. There are still tons of places that either have zero automated tests or have never used CI (and often have neither). And yes, these places have full time developers that produce new code daily. Often testing is all done manually, and code changes pushed manually. I'm not saying those things aren't common, I just don't think it is anywhere close to "nearly everyone".
I think mutation testing is a great, great technique ~ But it takes a very long time to run!
(At least that was my experience with ts/js and stryker in 2021 where i last used it)
My problem with mutation testing is that in the limit, it requires your tests to be a re-implementation of the code. Furthermore, it means you spend a lot of your time testing the structure of the code rather than the logical behavior boundaries.
I think golden and property testing of the boundaries mixed with regression tests for actual bugs the code has really had are the ones where the tests pay for themselves in the long run. Everything else is speculative. Does the test cover a bug that would ever make it past the most cursory of reviews?
Like, let's just look at an example from the article, replacing a + with a -. There are a lot of cases where that will just result in an infinite loop. Just the cursory review of running the code once will catch that. Why are you rebuilding the program and test suite every time you run these tests just to introduce that bug?
Like, the only way I can see this being value-positive is if you don't read your code or tests... oh.
i hhave a vague memory of an article title something like "Hunting Plastic Animals" from the 1970s or 80s about mutation testing. "Plastic animals" being the artifically introduced bugs, and "hunting" by the test suites.
I’m a bit skeptical of that approach. Tests can never catch all possible bugs, because tests can’t prove complete correctness of the code [0]. Only formal proofs can do that. Mutation testing therefore will always be able to come up with a new mutation that isn’t yet covered by the tests. So you will generally never have anything close to 100% mutation testing coverage, or even be able to express such a percentage.
It can still be useful for increasing test coverage in an interactive way, but the article doesn’t give any methodology to decide when enough is enough, or even for assessing the relative relevance of different mutations. So it’s a bit like poking around in the dark.
[0] except in the rare case that the possible inputs can be exhaustively enumerated in short finite time, such as testing a pure function taking a 32-bit integer as its sole input (2^32 possible inputs that can be enumerated)
The irony here is that AI makes this easier ... while also making it less valuable.
What I mean is, except for literal typos, bugs aren't generally caused by one character being off. They're caused by (say) not remembering function X will do Y under condition Z.
So, it's a proxy: you find tests that fail to catch typos as a proxy for catching tests that might miss real issues.
But how good of a proxy is it? Will finding out if a bunch of my tests miss == becoming != tell me if my tests will catch me forgetting to pass that critical foo argument to my doBar? ¯\_(ツ)_/¯
The one thing we know mutation testing is good for is catching typos, and with AI writing all my code, typos are the last thing I worry about.
[dead]
Claude Opus 5.5 has really gotten me into mutation testing. It's definitely a lot slower than normal regression testing (you have to rebuild and rerun your whole regression test suite on each mutant, so you don't want to do it as often) but it has had salutary effects on the quality of the regression test suite. I had occasionally done tiny amounts of mutation testing informally before, and I'd sometimes practiced "test-first" coding where I run the test before implementing the functionality, which is a very lightweight version of mutation testing, but now I'm doing mutation testing enthusiastically.
On the plus side, computers are faster now, so it's possible to run quantities of regression tests that would have been unthinkable 20 years ago.