| ▲ | Killed Any Mutants Lately?(entropicthoughts.com) | |||||||||||||
| 17 points by birdculture 4 days ago | 9 comments | ||||||||||||||
| ▲ | MattJ100 36 minutes ago | parent | next [-] | |||||||||||||
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. | ||||||||||||||
| ▲ | kragen an hour ago | parent | prev | next [-] | |||||||||||||
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 it 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. | ||||||||||||||
| ▲ | Garlef 2 hours ago | parent | prev | next [-] | |||||||||||||
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) | ||||||||||||||
| ||||||||||||||
| ▲ | layer8 30 minutes ago | parent | prev | next [-] | |||||||||||||
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) | ||||||||||||||
| ▲ | chowells 3 minutes ago | parent | prev | next [-] | |||||||||||||
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. | ||||||||||||||
| ▲ | mac3n 4 days ago | parent | prev | next [-] | |||||||||||||
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. | ||||||||||||||
| ▲ | hungryhobbit an hour ago | parent | prev [-] | |||||||||||||
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. | ||||||||||||||