Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Intro to Mutation Testing
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Jeanne Boyarsky
March 05, 2018
Technology
140
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Intro to Mutation Testing
Presented at Oracle Code NYC 2018. This is a repeat of the session I gave at JavaOne in 2017.
Jeanne Boyarsky
March 05, 2018
More Decks by Jeanne Boyarsky
See All by Jeanne Boyarsky
JavaOne Java 25
boyarsky
0
70
JUnit 6 + exploring the testing ecosystem
boyarsky
0
73
Timeline of a (NYC) FRC Session/Regional
boyarsky
0
67
2025 Toastmasters Path Reference
boyarsky
0
180
2025 Toastmasters Path Changes Update Overview and Reference
boyarsky
0
87
Mentor_Conference_Presentation.pdf
boyarsky
0
51
2025-java-does-what-now.pdf
boyarsky
0
120
Beyond JUnit 5
boyarsky
0
86
Java 21 Certification (or learning new features)
boyarsky
0
160
Other Decks in Technology
See All in Technology
Microsoft Build Keynoteふりかえり
tomokusaba
0
110
サイバーセキュリティ概論 / Introduction to Cybersecurity
ks91
PRO
0
170
2026.06.13_AI時代に事業会社が「SIer出身エンジニア」を求める理由 / Why Businesses Seek Engineers with a System Integrator Background in the AI Era
jumtech
0
920
Rancherの紹介&Update情報(RancherJP Online Meetup #09)
yoshiyuki_kono
0
130
やさしいA2A入門
minorun365
PRO
7
630
Platform engineering for developers, architects & the rest of us (AI agents)
danielbryantuk
0
190
新しいVibe Codingと”自走”について
watany
5
200
TypeScript Compiler APIとPHP-Parserを活用し、TypeScriptとPHPで型を共有する
shuta13
0
370
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
390
React、まだ楽しくて草
uhyo
7
4.2k
protovalidate-es を導入してみた
bengo4com
0
160
Socrates × Looker 〜セマンティックレイヤーで進化するデータ分析エージェント〜
hanon52_
1
960
Featured
See All Featured
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Exploring anti-patterns in Rails
aemeredith
3
400
Ruling the World: When Life Gets Gamed
codingconduct
0
250
Large-scale JavaScript Application Architecture
addyosmani
515
110k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
160
Between Models and Reality
mayunak
4
330
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
720
Code Review Best Practice
trishagee
74
20k
Paper Plane (Part 1)
katiecoart
PRO
0
8.7k
Transcript
Intro to Mutation Testing speakerdeck.com/boyarsky Twitter @jeanneboyarsky Blog: http://www.selikoff.net Jeanne
Boyarsky Oracle Code NYC – March 8, 2018
@jeanneboyarsky About Me 15 years as • Java Developer •
JUnit user
The Plan 1. About mutation testing 2. Live demo 3.
A look at types of mutants 4. Profit??? @jeanneboyarsky
Why write tests? @jeanneboyarsky It used to work!
How know if tests are good? @jeanneboyarsky
If test coverage low @jeanneboyarsky Write more tests! Not ready
for mutation testing of class
If test coverage high @jeanneboyarsky All done! Perfect code!
Or is it? Why is it saying nobody is registered?
@jeanneboyarsky
Code Review! @jeanneboyarsky
That’s a mutant! @jeanneboyarsky
Too many mutants! They’re everywhere! @jeanneboyarsky
PitClipse to the rescue! @jeanneboyarsky
@jeanneboyarsky PIT Integration Almost
JUnit 5 • Unofficial Fork: https://github.com/tobiasstadler/pitest-junit5-plugin • It’s coming: https://github.com/hcoles/pitest/issues/284
https://github.com/hcoles/pitest/issues/398 @jeanneboyarsky
Easy to run @jeanneboyarsky
The console flies by @jeanneboyarsky
Wait, we just had 100% coverage @jeanneboyarsky
We caught 5 mutants @jeanneboyarsky
More detail @jeanneboyarsky
Level up @jeanneboyarsky
Now 23 survived @jeanneboyarsky
Let’s try it! @jeanneboyarsky
Observations • JUnit tests must pass • Fixing one may
take care of more • Found a bug • Better tests @jeanneboyarsky
Now with all mutators @jeanneboyarsky
Observations • Better tests • Unused production code @jeanneboyarsky
Examples of Conditional Mutants @jeanneboyarsky Conditionals Boundary <= vs <
Negative Conditionals <= vs > Void Method Call Removes method calls
Examples of Math Mutants @jeanneboyarsky Math * vs / Increments
++ vs -- Invert Negatives x vs -x
Examples of Other Mutants @jeanneboyarsky Return Values x vs x+1
Disabled by default (false positives, duplicates or crashes) Constructor Calls Inline Constants Non Void Method Calls Remove Conditionals Experimental Member Variables Switch
Tips for bigger projects • Watch console to see if
still running • Reports on whole project – drill down/split up • Exclude long running tests • Experimental feature: incremental analysis @jeanneboyarsky
Review Code Coverage Mutation Testing Requirements
More info • http://pitest.org/ • https://github.com/philglover/pitclipse • https://dzone.com/articles/introduction-mutation @jeanneboyarsky
@jeanneboyarsky