Mutation Testing

Pest 3.0 is now available and the one feature I’m most excited about is mutation testing. I first tried mutation testing was with Infection PHP. It was not easy – and the results were horrifying. Using mutation testing I discovered my coverage of 85% was more likely in the teens. I fiddled with config to only test a few classes and ultimately opted not to use it as part of CI.

After seeing mutation testing in action I changed my code a bit – paying more attention to single responsibility in a method from a testing perspective rather than responsibilities.

I think the killer feature in Pest mutation testing is the ability to specify what a test covers. Instead of fiddling with a config file I can specify the intent in the test.

#laravel #tdd #php