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
130
1
Share
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
20
JUnit 6 + exploring the testing ecosystem
boyarsky
0
45
Timeline of a (NYC) FRC Session/Regional
boyarsky
0
52
2025 Toastmasters Path Reference
boyarsky
0
140
2025 Toastmasters Path Changes Update Overview and Reference
boyarsky
0
73
Mentor_Conference_Presentation.pdf
boyarsky
0
33
2025-java-does-what-now.pdf
boyarsky
0
110
Beyond JUnit 5
boyarsky
0
69
Java 21 Certification (or learning new features)
boyarsky
0
140
Other Decks in Technology
See All in Technology
Why we keep our community?
kawaguti
PRO
0
350
【社内勉強会】新年度からコーディングエージェントを使いこなす - 構造と制約で引き出すClaude Codeの実践知
nwiizo
30
15k
SSoT(Single Source of Truth)で「壊して再生」する設計
kawauso
2
400
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
2
17k
AI時代のシステム開発者の仕事_20260328
sengtor
0
320
Oracle Cloud Infrastructure:2026年3月度サービス・アップデート
oracle4engineer
PRO
0
210
会社紹介資料 / Sansan Company Profile
sansan33
PRO
16
410k
非同期・イベント駆動処理の分散トレーシングの繋げ方
ichikawaken
1
240
Datadog で実現するセキュリティ対策 ~オブザーバビリティとセキュリティを 一緒にやると何がいいのか~
a2ush
0
180
AI時代のオンプレ-クラウドキャリアチェンジ考
yuu0w0yuu
0
650
MIX AUDIO EN BROADCAST
ralpherick
0
130
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
91
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
150
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
160
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Optimizing for Happiness
mojombo
378
71k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
360
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.1k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
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