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
Jeanne Boyarsky
March 05, 2018
Technology
1
120
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
Tweet
Share
More Decks by Jeanne Boyarsky
See All by Jeanne Boyarsky
2025-java-does-what-now.pdf
boyarsky
0
11
Beyond JUnit 5
boyarsky
0
21
Java 21 Certification (or learning new features)
boyarsky
0
43
Preparing for the Java 21 cert + Learning New Features
boyarsky
0
170
Mastering Logging in Java
boyarsky
0
120
2025 FRC Changes and Awards - NYC FIRST
boyarsky
0
72
Managing Your Time for Work, Learning, and Fun
boyarsky
0
120
Preparing for the Java 21 Certification and Learning New Features
boyarsky
0
250
2024-java21.pdf
boyarsky
0
94
Other Decks in Technology
See All in Technology
Firestore → Spanner 移行 を成功させた段階的移行プロセス
athug
1
460
サラリーマンの小遣いで作るtoCサービス - Cloudflare Workersでスケールする開発戦略
shinaps
2
440
Aurora DSQLはサーバーレスアーキテクチャの常識を変えるのか
iwatatomoya
1
920
Platform開発が先行する Platform Engineeringの違和感
kintotechdev
4
560
Django's GeneratedField by example - DjangoCon US 2025
pauloxnet
0
150
研究開発と製品開発、両利きのロボティクス
youtalk
1
520
現場で効くClaude Code ─ 最新動向と企業導入
takaakikakei
1
240
AIのグローバルトレンド2025 #scrummikawa / global ai trend
kyonmm
PRO
1
280
AWSを利用する上で知っておきたい名前解決のはなし(10分版)
nagisa53
10
3.1k
BPaaSにおける人と協働する前提のAIエージェント-AWS登壇資料
kentarofujii
0
140
生成AIでセキュリティ運用を効率化する話
sakaitakeshi
0
660
5分でカオスエンジニアリングを分かった気になろう
pandayumi
0
240
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.7k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
GraphQLの誤解/rethinking-graphql
sonatard
72
11k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
The World Runs on Bad Software
bkeepers
PRO
70
11k
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