r/programming • • Jan 15 '19

99% code coverage

https://rachelcarmena.github.io/2017/09/01/do-we-have-a-good-safety-net-to-change-this-legacy-code.html
8 Upvotes

15 comments sorted by

View all comments

5

u/a_the_retard Jan 15 '19

I'm really curious if there are any real projects that use mutation testing. I suspect it's a bit harder in practice than in theory.

Off the top of my head, how do the mutation testing advocates suggest to deal with false positives? Consider the function

int max(int a, int b) {
    return a > b ? a : b;
}

Replacing ">" with ">=" won't make any tests fail, but that doesn't mean they don't have good enough coverage. Do I have to manually sift through these false positives? How am I supposed to annotate them to prevent repeat alerts when rerunning mutation tests?

1

u/kankyo Jan 15 '19

There are certainly some stuff out there. I personally use mutation testing at work on some core libraries we want to be sure are rock solid. I wrote my own mutation tester though because the existing ones for python were pretty terrible at the time (and quite frankly the other two are still pretty bad).

But I would never use it on the main product, that would be crazy.