Mutation Testing with PIT

Filip van Laenen (Computas)

Half-day workshop - in English

Approved_talk approved

Create some mutants and see whether any of them can pass the gates – it sounds like the start of a bad B movie. But in reality, it's a good description of how mutation testing works. It makes changes to the source code (the “mutants”), and then checks whether your unit tests (the “gates”) can detect and stop them.

Code coverage only tells you which lines of code aren't touched by unit tests. Mutation testing is a much more powerfull technique, which can reveal whether there are unit tests testing the wrong thing, whether there are some missing, or whether your system contains unnecessary code. And, unlike code coverage, it can't be gamed: simply having a unit test running through the code isn't enough, the mutant has to be killed to pass the mutation test.

During this workshop, you'll be introduced to what mutation testing is about, how it works, and how you can use it in a project. We'll set up a small Java project and work through an example to see the mutation testing tool PIT in action. After that, the participants can continue to work on the sample project learning to deal with mutations that won't go away, and how the PIT reports can be used to find the missing unit tests.

 
Primarily for: Developers, Architects

Participant requirements: A laptop with Java and Maven installed, and an IDE.

By