Mutation Testing in Java with Pitest

Traditional unit testing techniques like TDD and code coverage are not enough to write high-quality unit tests. In this course, you'll learn how mutation testing can help you write better tests.
Course info
Level
Intermediate
Updated
Aug 30, 2018
Duration
2h 0m
Table of contents
Description
Course info
Level
Intermediate
Updated
Aug 30, 2018
Duration
2h 0m
Description

At the core of mutation testing is a thorough knowledge of creating a test suite that you can trust. In this course, Mutation Testing in Java with Pitest, you'll learn how to evaluate your unit tests and improve them using Pitest. First, you’ll understand what mutation testing is and why it's needed. Next, you'll learn how to use Pitest to introduce small changes to your program and see if your unit tests can detect it. Finally, you'll discover how the results of mutation testing can be analyzed to discover bad tests. When you're finished with this course, you'll have a foundational knowledge of mutation testing that will help you as you move forward to test your programs in a better way.

About the author
About the author

Esteban Herrera has more than twelve years of experience in the software development industry. Having worked in many roles and projects, he has found his passion in programming with Java and JavaScript. Nowadays, he spends all his time learning new things, writing articles, teaching programming, and enjoying his kids.

More from the author
Design Patterns in Java: The Big Picture
Beginner
1h 49m
Dec 27, 2018
Spring WebFlux: Getting Started
Beginner
2h 42m
Feb 27, 2018
More courses by Esteban Herrera
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
(Music) Hi everyone. My name is Esteban Herrera, and welcome to my course, Mutation Testing in Java with Pitest. I have been working with Java for more than 10 years. I love the language and teaching all I know about it. Do you know that traditional unique testing practices like TDD and code coverage are not enough to create a test suite that you can fully trust? Only mutation testing can help you know how well you are testing your application. In this course, you are going to learn how to use Pitest, one of the most popular mutation testing tools for Java. Some of the major topics that we will cover include: how mutation testing helps you write better tests, how Pitest works, and how to detect and improve bad unit tests. By the end of this course, you'll know how to measure and improve the quality of your unit tests. Before beginning the course, you should be familiar with Java version 8 or above, Maven, JUnit versions 4 or 5, and the concept of code coverage. I hope you'll join me on this journey to learn mutation testing with the course, Mutation Testing in Java with Pitest at Pluralsight.

Performing Mutation Testing with Pitest
In this module, you'll learn how to configure and use Pitest in different environments. First, I'll talk about this and I will use in this course and then I'll show you the classes and tests of the project we are going to work with. Next, I'll explain how Pitest works. After that, I'll show you how to set up Pitest using its Maven plugin, as well as some of its configuration options. I'll also show you how to set up Pitest using Gradle. The options are basically the same, and you can skip this part if you only work with Maven. Finally, I'll show you how to use Pitest in Eclipse and IntelliJ as plugins. I'll do this using a version of the project with JUnit 4, because that's the version if JUnit the plugins support at this time. You'll see why in a few minutes. Now let's get started.

Detecting Bad Tests with Mutation Testing
In this module, I'll show you how to analyze the report generated by Pitest. We'll review the information the report presents, and then we'll go over each of the test classes of the application to add, remove, or modify the test methods to increase the mutation testing score as much as possible. So let's get started.

Working with Mutation Operators
Mutation operators define how to change your program to simulate those subtle errors on which mutation testing is based. In this module, we are going to review the mutation operators that Pitest offers. They are also known as mutators and there are about 20, but some of them are very specific and you'll hardly ever use them. They are divided into groups. I'll show you which mutators belong to each group and for each mutator, its rules and an example of how it's applied. Finally, I'll show you how to configure Pitest to apply a group of mutators, individual mutators, or a combination of this. So let's get started.

Exploring Pitest Configuration Options
Pitest provides many configuration options. In this module, you are going to learn how to configure three specific aspects of Pitest. First, we are going to explore configuration options to customize the way Pitest generates the report. Next, you learn how to integrate Pitest with a source control system using the Maven plugin for software configuration management. So Pitest can only check the parts of your application that have changed since the last commit. And finally, you'll learn about some configuration options to speed up the mutation testing process. So let's get started.

Using Mutation Testing in the Real World
In this module, I'll wrap up the course by giving you some tips and best practices about how to use mutation testing. On the other hand, not everything about mutation testing is perfect. So I'll also talk about the disadvantages of mutation testing and Pitest, so you know the good and the bad things about them. Finally, I'll give you a quick summary of each module of the course and some recommendations to learn more, so let's get started.