How good are your tests?
Noam Shaish
How do we test?
• Unit testing
• Continues Integration
• Test-drive development (TDD)
• Code coverage
Unit testing
• Prove code works
• Instant regression tests
• Improve code design
Continous Integration
• Automated testing
• Maintain single source repository
• Collect statistics
All tests passed
So f*cking what?
Test that always pass
Code coverage
• Measures line/branches executed during testing
• Common way to estimate testing
We are all covered
• Are we?
Test that gives full coverage
So how good
are your tests?
Mutation testing
• Proposed by Richard J. Lipton in 1971
• A way to measure the quality of your tests
Mutation
• A small change in your code
Mutant
• A mutated version of your class
Mutation testing
• Create mutants
• Run tests
• Check outcomes
Outcomes: killed
• Mutant killed: Mutant is killed if a test fails, which
proves the mutated code is properly tested
Outcomes: lives
• Mutant lives: Mutant didn't fail any test…
Outcomes: timed out
• Mutant timed out: Mutant caused program to loop or
stuck
Outcomes: other
• There there possible outcome but less relevant
Mutation testing with PIT
• http://pitest.org
• Configurable ‘Mutators’
• ASM (byte-code manipulation) is used for manipulation
• No mutation storage
• Reports
Mutators: 

Condition Boundary
> into >=
< into <=
>= into >
<= into <
Mutators: 

Negate Conditions
== into !=
!= into ==
>= into <
<= into >
< into >=
> into <=
Mutators: 

Remove Condition
if ( a == b) { attack(); }
into
if ( true ) { attack(); }
Mutators: 

Math
+ into -
- into +
* into /
/ into *
% into *
& into |
>> into <<
<< into >>
>>> into <<<
a++ into a—
a— into a++
Mutators:

Others
• Replace return values (return a; into return 0;)
• Remove void calls (attack(); is removed)
• Replace value by null
• Some mutators enabled by default and some aren't
Mutation testing speed
• Mutation testing is CPU
intensive
• Multiple test runs
• PIT has a lot of speed
optimizations
Which test to run?
• PIT uses code coverage to
decide which test to run
• A mutation is created only on
lines covered by 3 test
Summary
• Mutation testing automatically tests your tests
• Mutation testing can find bugs in your tests
• Code coverage is half the story, and gives a false
sense of security
• Mutation testing with PIT is easy
Show me some code

More Related Content

PPTX
Unit Testing talk
PDF
Unit testing
PPTX
I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
PDF
TMPA-2017: 5W+1H Static Analysis Report Quality Measure
PDF
Improving the accuracy and reliability of data analysis code
PPTX
Unit test and continuous deployment
PPTX
The Art of Testing Less without Sacrificing Quality @ ICSE 2015
PDF
Introduzione allo Unit Testing
Unit Testing talk
Unit testing
I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
TMPA-2017: 5W+1H Static Analysis Report Quality Measure
Improving the accuracy and reliability of data analysis code
Unit test and continuous deployment
The Art of Testing Less without Sacrificing Quality @ ICSE 2015
Introduzione allo Unit Testing

What's hot (20)

PPTX
Tdd guide
PPTX
Empirically Detecting False Test Alarms Using Association Rules @ ICSE 2015
PDF
PPTX
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
PDF
Software Testing
PPTX
Automatic Bug Fixing
PDF
Pitfalls Of Tdd Adoption by Bartosz Bankowski
PPT
Measuring the Gain of Automatic Debug
PPTX
Test suite minimization
PDF
Automated Testing for Embedded Software in C or C++
PDF
Best practices for unit testing RxJava
PPTX
Put the Tests Before the Code
PDF
TMPA-2017: Live testing distributed system fault tolerance with fault injecti...
DOCX
Test driven development and unit testing with examples in C++
PDF
Software testing
PPTX
Bug prediction + sdlc automation
PPTX
Testing - Is This Even a Thing?
PPT
Automated Regression Testing for Embedded Systems in Action
PDF
Making Your Own Static Analyzer Using Freud DSL. Marat Vyshegorodtsev
PDF
TDD reloaded - JUGTAA 24 Ottobre 2012
Tdd guide
Empirically Detecting False Test Alarms Using Association Rules @ ICSE 2015
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
Software Testing
Automatic Bug Fixing
Pitfalls Of Tdd Adoption by Bartosz Bankowski
Measuring the Gain of Automatic Debug
Test suite minimization
Automated Testing for Embedded Software in C or C++
Best practices for unit testing RxJava
Put the Tests Before the Code
TMPA-2017: Live testing distributed system fault tolerance with fault injecti...
Test driven development and unit testing with examples in C++
Software testing
Bug prediction + sdlc automation
Testing - Is This Even a Thing?
Automated Regression Testing for Embedded Systems in Action
Making Your Own Static Analyzer Using Freud DSL. Marat Vyshegorodtsev
TDD reloaded - JUGTAA 24 Ottobre 2012
Ad

Viewers also liked (20)

DOCX
Lakshmi Krishna Iyer CV
PDF
Edwin E. Brochin Resume
PPTX
Curriculum vitae ku
PPT
Trends of contemporary s
PDF
Add on courses
PPTX
Fast food
PDF
2015 CNY E-CATALOGUE
PPTX
Myths and Misconceptions about Grammar
DOCX
Rpt (sej) thn 5 2015
PPTX
Economic terrorism
PPTX
Exotic fruits and vegetables
PDF
Rpt sejarah tahun 4 kssr
PDF
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
PDF
Mutation testing
PDF
Testing with Docker
PDF
Efficient Parallel Testing with Docker
DOCX
Will Haig 2015 v2
PDF
Using Docker for Testing
PPTX
Javantura v3 - Mutation Testing for everyone – Nicolas Fränkel
Lakshmi Krishna Iyer CV
Edwin E. Brochin Resume
Curriculum vitae ku
Trends of contemporary s
Add on courses
Fast food
2015 CNY E-CATALOGUE
Myths and Misconceptions about Grammar
Rpt (sej) thn 5 2015
Economic terrorism
Exotic fruits and vegetables
Rpt sejarah tahun 4 kssr
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
Mutation testing
Testing with Docker
Efficient Parallel Testing with Docker
Will Haig 2015 v2
Using Docker for Testing
Javantura v3 - Mutation Testing for everyone – Nicolas Fränkel
Ad

Similar to How good are your tests? (20)

PDF
Mutation testing for a safer Future
PPTX
Kill the mutants and test your tests - Roy van Rijn
PDF
Kill the mutants - A better way to test your tests
PDF
Mutation Testing
PPTX
Mateusz Bryła - Mutation testing
PDF
Must.kill.mutants. TopConf Tallinn 2016
PDF
Vaidas Pilkauskas and Tadas Ščerbinskas - Can you trust your tests?
PPTX
Joker - Improve your tests with mutation testing
PDF
Mutation testing in Java
PPT
Mutation Testing and MuJava
PDF
MUTANTS KILLER - PIT: state of the art of mutation testing system
PDF
Can You Trust Your Tests? (Agile Tour 2015 Kaunas)
PPTX
GeeCON - Improve your tests with Mutation Testing
PDF
Mutation Testing.pdf
PPTX
Voxxed Days Athens - Improve your tests with Mutation Testing
PDF
Mutation testing pixels camp 2019
PDF
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
PPTX
ConFoo - Improve your tests with mutation testing
PPTX
Craft-Conf - Improve your Tests with Mutation Testing
PDF
50120140502017
Mutation testing for a safer Future
Kill the mutants and test your tests - Roy van Rijn
Kill the mutants - A better way to test your tests
Mutation Testing
Mateusz Bryła - Mutation testing
Must.kill.mutants. TopConf Tallinn 2016
Vaidas Pilkauskas and Tadas Ščerbinskas - Can you trust your tests?
Joker - Improve your tests with mutation testing
Mutation testing in Java
Mutation Testing and MuJava
MUTANTS KILLER - PIT: state of the art of mutation testing system
Can You Trust Your Tests? (Agile Tour 2015 Kaunas)
GeeCON - Improve your tests with Mutation Testing
Mutation Testing.pdf
Voxxed Days Athens - Improve your tests with Mutation Testing
Mutation testing pixels camp 2019
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
ConFoo - Improve your tests with mutation testing
Craft-Conf - Improve your Tests with Mutation Testing
50120140502017

Recently uploaded (20)

PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
PPTX
Introduction to Windows Operating System
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Cybersecurity: Protecting the Digital World
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
AI Guide for Business Growth - Arna Softech
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
Trending Python Topics for Data Visualization in 2025
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Autodesk AutoCAD Crack Free Download 2025
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
Introduction to Windows Operating System
Advanced SystemCare Ultimate Crack + Portable (2025)
Cybersecurity: Protecting the Digital World
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
AI Guide for Business Growth - Arna Softech
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Tech Workshop Escape Room Tech Workshop
DNT Brochure 2025 – ISV Solutions @ D365
Trending Python Topics for Data Visualization in 2025
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Matchmaking for JVMs: How to Pick the Perfect GC Partner
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
CNN LeNet5 Architecture: Neural Networks
Autodesk AutoCAD Crack Free Download 2025

How good are your tests?