STARWEST 2021 Concurrent Session : Test Your Unit Tests: Mutation Testing

SEE PRICING & PACKAGES

Wednesday, October 6, 2021 - 11:30am to 12:30pm

Test Your Unit Tests: Mutation Testing

Even if your code coverage is 80%, how much confidence do you have in your unit tests? Are they catching the edge cases? Can you fearlessly refactor? Add new features? Perhaps you are writing code that another team will rely on (or worse, you have to rely on!) Or maybe you have to untangle some ugly spaghetti code and want some idea of what it does before you start chopping it up. A mutation testing framework like PIT from pitest.org tests your JUnit tests and shows you what you are and aren’t testing. If your unit tests all pass, mutation tests make changes to a copy of your source code and rerun the tests to see if they catch the injected errors. If not, the mutation is said to survive, and you know the code isn’t tested, even if code coverage tools suggest otherwise. Gene will show you how to use mutation tests to build confidence in your unit tests. He’ll demonstrate using PIT mutation tests against JUnit tests and show how to use it to turn legacy code into safe-to-refactor Java. Join us if you are struggling to trust your unit tests.

Steampunk

Gene Gotimer is a DevSecOps engineer at Steampunk, often working with federal government clients. He considers himself a developer, but he usually focuses on DevSecOps practices such as continuous integration, repeatable builds, unit testing, automated testing, security tools, and automated deployments. Gene feels strongly that repeatability, quality, and security are all strongly intertwined; each of them is dependent on the other two, which just makes agile and DevSecOps that much more crucial to software development.