Source: achievers.engineering

Mutation testing — Test your tests

Category: PHP

Mutation testing is the technique of purposefully adding bugs to our codebase and checking whether tests fail. If we have a well-tested codebase, we trust that the code is doing what it is supposed to do. With developers writing important tests, we face the issue that tests are also pieces of code that could potentially have bugs.

If we add a bug and run our tests, we can check whether some of the tests are going to fail or not.

For this codebase, we could have these tests: This way we test both cases: Now we can add a bug in the TaxCalculator to see if any of these tests would fail.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners