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
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
Timeline of a (NYC) FRC Session/Regional
boyarsky
0
45
2025 Toastmasters Path Reference
boyarsky
0
120
2025 Toastmasters Path Changes Update Overview and Reference
boyarsky
0
66
Mentor_Conference_Presentation.pdf
boyarsky
0
26
2025-java-does-what-now.pdf
boyarsky
0
100
Beyond JUnit 5
boyarsky
0
63
Java 21 Certification (or learning new features)
boyarsky
0
130
Preparing for the Java 21 cert + Learning New Features
boyarsky
0
260
Mastering Logging in Java
boyarsky
0
160
Other Decks in Technology
See All in Technology
Raspberry Pi AI HAT+ 2 介紹(#49)
piepie_tw
PRO
0
110
技術キャッチアップ効率化を実現する記事推薦システムの構築
yudai00
2
160
どこで打鍵するのが良い? IaCの実行基盤選定について
nrinetcom
PRO
2
100
AIに視覚を与えモバイルアプリケーション開発をより円滑に行う
lycorptech_jp
PRO
1
670
What's new in Go 1.26?
ciarana
2
270
Databricksアシスタントが自分で考えて動く時代に! エージェントモード体験もくもく会
taka_aki
0
250
【2026年版】生成AIによる情報システムへのインパクト
taka_aki
0
200
LINE Messengerの次世代ストレージ選定
lycorptech_jp
PRO
15
5.9k
トラブルの大半は「言ってない」x「言ってない」じゃねーか!!
ichimichi
0
240
2026-02-25 Tokyo dbt meetup プロダクトと融合したCI/CD で実現する、堅牢なデータパイプラインの作り方
y_ken
0
160
ソフトウェアアーキテクトのための意思決定術: Create Decision Readiness—The Real Skill Behind Architectural Decision
snoozer05
PRO
27
7.9k
Snowflakeデータ基盤で挑むAI活用 〜4年間のDataOpsの基礎をもとに〜
kaz3284
1
310
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
95
Practical Orchestrator
shlominoach
191
11k
Statistics for Hackers
jakevdp
799
230k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.7k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
130
Side Projects
sachag
455
43k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
280
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Amusing Abliteration
ianozsvald
0
120
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
300
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