Dave Aronson

Camp Counselor

Kill All Mutants! (Intro to Mutation Testing)

Event Logo

Tuesday, July 26, 2022 - 6:00 PM UTC, for 1 hour.

AT THAT (In-Person Only) Regular, 60 minute presentation

Room: C

weird tricks
fun
code quality

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?!
favorited by:
Kevin Moens Michael Caron Cory Gideon Robert Nicholson Timothy Tyson