Back to articles
Your Mutation Testing Tool Should Make You Explain Yourself

Your Mutation Testing Tool Should Make You Explain Yourself

via Dev.to PythonMike Lane

Every team that adopts mutation testing hits the same wall around week two. The tool generates a mutation. Something like flipping a > to >= in a boundary check you know is dead code. Or injecting a fault into a logging call that doesn't affect behavior. The mutation survives, your score drops, and someone on the team asks the reasonable question: can we just ignore this one? That's not the wrong question. Some mutations genuinely aren't worth killing. The wrong answer is making suppression easy and invisible. I've been building pytest-gremlins, a mutation testing plugin for pytest, and this week we shipped v1.5.0 with a feature I've been thinking about for a while: inline mutation pardoning with mandatory reasoning and enforcement ceilings. It works like this. You add a comment to the line: logger . debug ( f " Processing { item . id } " ) # gremlin: pardon[logging-only, no behavioral impact] The pardon keyword tells pytest-gremlins to skip mutations on that line. The brackets force y

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
2 views

Related Articles