Mutator for null checking method arguments

3 views
Skip to first unread message

Tim Fulcher

unread,
Jun 13, 2022, 7:51:29 AMJun 13
to pitu...@googlegroups.com
Hi

I'm relatively new to PIT but I can I ask why I don't appear to see a mutator that attempts to take method Object arguments and replace them with nulls?
It's a bit contrived I suppose, but in the past I've seen test cases that always deal with non null arguments and pass fine, but the code blows up in production when upstream from a method call an input argument becomes a null, throwing a NPE. Of course it's highly likely the test itself completely fails, it's more around detecting when the test code doesn't cover that behaviour. I guess the mutant doesn't survive either way which is perhaps the difficulty 

Thanks 

Tim 


Henry Coles

unread,
Jun 13, 2022, 8:17:25 AMJun 13
to pitu...@googlegroups.com
An operator such as the one you describe would be 'unstable', that is to say highly likely to make any test that exercised it fail due to a NullPointerException. So while it might be possible, it probably wouldn't be very valuable. The more useful operators are generally more stable, ie they produce mutants that are harder to detect.

For example, mutating  x > y to x >= y, is much more likely to find interesting issues then mutating it to x < y, as the mutant is distinguished from the original program by far fewer inputs.

Henry

--
You received this message because you are subscribed to the Google Groups "PIT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pitusers+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pitusers/CAHmbbjw7%3D-W83SE_GieEd9d5Py4K5xzkYYpEaZ-e%3DOcjQJL7zQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages