Kill THAT Mutant! (Intro to Mutation Testing)
How good is your test suite? Would it all still pass if the tested code was changed? If so, there may be problems with your code, your tests, or both! Mutation Testing reveals these cases. It makes lots of slightly altered versions, called "mutants", of each of your functions. If any mutants let all of the code's tests succeed, that implies certain flaws, mainly gaps in your test suite, or code that can (and therefore should) be removed. This talk will tell you how to use mutation testing, its benefits, drawbacks, inner workings, and history. There will be several examples (in Ruby, which is close enough to English to treat as pseudocode), and a list of tools for many popular languages. You will come away equipped with a powerful new technique for making sure your tests are strict and your code is meaningful.
Prerequisites
Must already be comfortable with basic unit testing. Semi-advanced foundational CS knowledge (mainly, what an Abstract Syntax Tree is) would also be helpful, but not absolutely required. However, applying it well may take some accumulated general programming experience that juniors might not have yet. So, I usually label this as for advanced or at least intermediate devs.
Take Aways
- How to make sure your test suite is sufficiently strict
- How to root out dead, unused, unreachable, and especially, untested code
- What on Infinite Earths is "mutation testing" anyway, why should we do it, how do we do it, and how does it work?!
- Why test coverage is not enough