If you use #InfectionPHP,

Your initial goal should be to achieve at least 90% code coverage and at least 90% MSI (Mutation Score Indicator).

If your codebase correctly handles all escaped mutants, it’s already strongly typed and behaviorally verified with #PHPUnit tests, without requiring additional static analysis tools.

SA tools will only be useful to identify missing or incomplete docblocks (e.g. array shapes) to improve IDE support and autocomplete accuracy.

https://github.com/sponsors/infection

#PHP

Sponsor @infection on GitHub Sponsors

Mutation Testing for PHP. Helps writing better code and tests.

GitHub
Path Coverage or Mutation Testing?

How thoroughly do your tests cover the code, and how reliably do they detect real errors? I show you how to find out.

phpunit.expert
Leveraging Propagated Infection to Crossfire Mutants

Mutation testing was proposed to identify weaknesses in test suites by repeatedly generating artificially faulty versions of the software (mutants) and determining if the test suite is sufficient to detect them (kill them). When the tests are insufficient, each surviving mutant provides an opportunity to improve the test suite. We conducted a study and found that many such surviving mutants (up to 84% for the subjects of our study) are detectable by simply augmenting existing tests with additional assertions, or assertion amplification. Moreover, we find that many of these mutants are detectable by multiple existing tests, giving developers options for how to detect them. To help with these challenges, we created a technique that performs memory-state analysis to identify candidate assertions that developers can use to detect the surviving mutants. Additionally, we build upon prior research that identifies ``crossfiring'' opportunities -- tests that coincidentally kill multiple mutants. To this end, we developed a theoretical model that describes the varying granularities that crossfiring can occur in the existing test suite, which provide opportunities and options for how to kill surviving mutants. We operationalize this model to an accompanying technique that optimizes the assertion amplification of the existing tests to crossfire multiple mutants with fewer added assertions, optionally concentrated within fewer tests. Our experiments show that we can kill all surviving mutants that are detectable with existing test data with only 1.1% of the identified assertion candidates, and increasing by a factor of 6x, on average, the number of killed mutants from amplified tests, over tests that do not crossfire.

arXiv.org
@ghostwriter but SA has a much faster feedback loop, and doesn't explode in execution time as mutation testing does... Also, you can use a package like this one to use SA to kill mutants: https://github.com/Roave/infection-static-analysis-plugin
GitHub - Roave/infection-static-analysis-plugin: :white_check_mark: Static analysis on top of mutation testing - prevents escaped mutants from being invalid according to static analysis

:white_check_mark: :dragon_face: Static analysis on top of mutation testing - prevents escaped mutants from being invalid according to static analysis - GitHub - Roave/infection-static-analysis-plu...

GitHub