SlideShare a Scribd company logo
e-movimento Software Design & Beratung GmbH
1030 Wien ● Marxergasse 7/26 ► www.e-movimento.com
Mutation-Testing mit PIT
www.pitest.org
Mutation Testing – Was?
 Definition (https://en.wikipedia.org/wiki/Mutation_testing):
Mutation testing (or Mutation analysis or Program
mutation) is used to design new software tests and evaluate
the quality of existing software tests. Mutation testing
involves modifying a program in small ways. Each mutated
version is called a mutant and tests detect and reject
mutants by causing the behavior of the original version to
differ from the mutant. This is called killing the mutant. Test
suites are measured by the percentage of mutants that they
kill.
► www.e-movimento.com, Sebastian Dietrich2
Mutation Testing – Wozu?
 Ziel:
The purpose is to help the tester develop effective tests or
locate weaknesses in the test data used for the program or
in sections of the code that are seldom or never accessed
during execution. Mutation testing is a form of white-box
testing.
 Reicht das?
"Quis custodiet ipsos custodes?“
“Wer wird die Wächter selbst bewachen?“
[Juvenal, Satire 6, 347f.]
► www.e-movimento.com, Sebastian Dietrich3
 muJava A mutation tool for Java that
includes class-level operators
 mutate.py A Python script to mutate
C-programs
 Mutator A source-based multi-
language commercial mutation
analyzer for concurrent Java, Ruby,
JavaScript and PHP
 Bacterio Mutation testing tool for
multi-class Java systems
 Javalanche Bytecode-based mutation
testing tool for Java
 Major Compiler-integrated mutation
testing framework for Java
 Jumble Bytecode-based mutation
testing tool for Java
 PIT Bytecode-based mutation
testing tool for Java
 Stryker Mutation testing tool for
JavaScript
 Mutant AST based mutation testing
tool for Ruby
 Jester Source-based mutation testing
tool for Java
 Judy Mutation testing tool for Java
 Heckle Mutation testing tool for Ruby
 NinjaTurtles IL-based mutation testing
tool for .NET and Mono
 Nester Mutation testing tool for C#
 Humbug Mutation testing tool for PHP
 MuCheck Mutation analysis library for
Haskell
Mutation Testing - PIT
► www.e-movimento.com, Sebastian Dietrich4
PIT
 Ändert Bytecode und lässt
Tests laufen
 Arbeitet mit ant, maven,
gradle, ...
 Plugins für Eclipse, IDEA, ...
 Dunkelgrün = Mutation Coverage
 Hellgrün = Line Coverage
 Hellrot = keine Line Coverage
 Dunkelrot = keine Mutation Coverage
► www.e-movimento.com, Sebastian Dietrich5
 Conditionals Boundary:
<  <=, >=  >, ...
 Negate Conditionals:
==  !=, >=  <
 Remove Conditionals:
a == b  true
 Math Mutator:
+  -, &  |, <<  >>, ...
 Increments Mutator:
i++  i—, i--  i++
 Invert Negatives:
-i  i
 Inline Constant:
int i = 5;  int i =-1;
 Return Values:
return true;  return false;
return x;  return x+1;
return obj;  return null;
return null;  RuntimeExc
 Void Method Call:
doSomething();  ;
 Non Void Method Call:
return5();  0;
 Constructor Call:
new Object();  null;
PIT – Mutators (Auszug – in Summe 7/13)
► www.e-movimento.com, Sebastian Dietrich6
Praxis – UnitTests eines Moduls
 1.735 Tests  69,5% Coverage (lt. Sonar)
 Min. 5GB RAM für Maven-Build
  12857 Mutationen, davon 5312 gekillt (weil doppelt)
  19.117 Tests
  41% Mutation Coverage (63% Line Coverage)
Laufzeit
 mvn test  3:18 min.
vs.
 mvn pitest-maven:mutationCoverage 
► www.e-movimento.com, Sebastian Dietrich8
Laufzeit – Aber...
 Incremental analysis möglich (nicht getestet):
 Mutation Killed, weder Test noch Klasse geändert  Mutation gilt
weiterhin als gekilled
 Mutation Überlebt, weder Test noch Klasse geändert, kein neuer
Test covered diese Klasse  Mutation gilt weiterhin als überlebt
 Mutation Killed, Klasse oder Test geändert  Mutation wird
vermutlich weiterhin gekilled werden  höhere Prio
 ...
► www.e-movimento.com, Sebastian Dietrich9
Konklusio
 Für Coverage-Kennzahlen größerer Module ungeeignet
(da zu viel RAM nötig)
 Für Build vermutlich ungeeignet (da zu langsam –
incremental analysis check noch offen)
 Zum Schreiben/Perfektionieren/Verbessern einzelner
Unit-Tests gut geeignet
 Am besten mit Plugins arbeiten
► www.e-movimento.com, Sebastian Dietrich10

More Related Content

PPTX
Mutation testing
PDF
Mutation testing
PDF
Kill the mutants - A better way to test your tests
KEY
An introduction to mutation testing
PDF
Mutation Testing
PDF
[Review] Predictive Mutation Testing
PPTX
Kill the mutants and test your tests - Roy van Rijn
PDF
JS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScript
Mutation testing
Mutation testing
Kill the mutants - A better way to test your tests
An introduction to mutation testing
Mutation Testing
[Review] Predictive Mutation Testing
Kill the mutants and test your tests - Roy van Rijn
JS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScript

What's hot (20)

PDF
Mutation Testing with PIT (Booster 2014, 2014-MAR-13)
PPTX
GeeCON - Improve your tests with Mutation Testing
PPT
Mutation Testing and MuJava
PPTX
Mutation testing
PDF
MUTANTS KILLER - PIT: state of the art of mutation testing system
PPT
Mutation testing
PPTX
Mutation Testing
PPTX
ATPG flow chart
PDF
Mutation testing in Java
PDF
Test driven development - JUnit basics and best practices
PDF
Unit testing with Junit
PPT
PDF
Software Engineering - RS3
PPTX
Introduction to JUnit
PDF
Unit testing 101
PDF
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
PPT
Simple Unit Testing With Netbeans 6.1
PDF
An introduction to Google test framework
PDF
Unit testing with JUnit
PDF
Unit testing best practices with JUnit
Mutation Testing with PIT (Booster 2014, 2014-MAR-13)
GeeCON - Improve your tests with Mutation Testing
Mutation Testing and MuJava
Mutation testing
MUTANTS KILLER - PIT: state of the art of mutation testing system
Mutation testing
Mutation Testing
ATPG flow chart
Mutation testing in Java
Test driven development - JUnit basics and best practices
Unit testing with Junit
Software Engineering - RS3
Introduction to JUnit
Unit testing 101
[JS EXPERIENCE 2018] “Who watches the watchmen": Testando nossos testes - Mar...
Simple Unit Testing With Netbeans 6.1
An introduction to Google test framework
Unit testing with JUnit
Unit testing best practices with JUnit
Ad

Similar to Mutation-Testing mit PIT (20)

PPTX
Joker - Improve your tests with mutation testing
PPTX
Javantura v3 - Mutation Testing for everyone – Nicolas Fränkel
PPTX
I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
PPTX
MuFinal
PDF
Mutation Testing
PDF
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
PPTX
Voxxed Days Athens - Improve your tests with Mutation Testing
PDF
Mutation testing pixels camp 2019
PDF
Kill the Mutants - a better way to test your tests by Roy van Rijn
PDF
Mutation Testing: Start Hunting The Bugs
PPTX
ConFoo - Improve your tests with mutation testing
PDF
Vaidas Pilkauskas and Tadas Ščerbinskas - Can you trust your tests?
PPTX
Mateusz Bryła - Mutation testing
PDF
Must.kill.mutants. TopConf Tallinn 2016
PPTX
Craft-Conf - Improve your Tests with Mutation Testing
PDF
Mutation Testing.pdf
PPTX
Codemash - Mutation testing to the rescue of your tests
PDF
Can You Trust Your Tests? (Agile Tour 2015 Kaunas)
PPTX
[AnDevCon 2016] Mutation Testing for Android
PPTX
Codemotion Berlin - Improve your tests with Mutation Testing
Joker - Improve your tests with mutation testing
Javantura v3 - Mutation Testing for everyone – Nicolas Fränkel
I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
MuFinal
Mutation Testing
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
Voxxed Days Athens - Improve your tests with Mutation Testing
Mutation testing pixels camp 2019
Kill the Mutants - a better way to test your tests by Roy van Rijn
Mutation Testing: Start Hunting The Bugs
ConFoo - Improve your tests with mutation testing
Vaidas Pilkauskas and Tadas Ščerbinskas - Can you trust your tests?
Mateusz Bryła - Mutation testing
Must.kill.mutants. TopConf Tallinn 2016
Craft-Conf - Improve your Tests with Mutation Testing
Mutation Testing.pdf
Codemash - Mutation testing to the rescue of your tests
Can You Trust Your Tests? (Agile Tour 2015 Kaunas)
[AnDevCon 2016] Mutation Testing for Android
Codemotion Berlin - Improve your tests with Mutation Testing
Ad

Recently uploaded (20)

PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
ai tools demonstartion for schools and inter college
PDF
Nekopoi APK 2025 free lastest update
PDF
AI in Product Development-omnex systems
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
top salesforce developer skills in 2025.pdf
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
medical staffing services at VALiNTRY
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
ai tools demonstartion for schools and inter college
Nekopoi APK 2025 free lastest update
AI in Product Development-omnex systems
Design an Analysis of Algorithms II-SECS-1021-03
top salesforce developer skills in 2025.pdf
How Creative Agencies Leverage Project Management Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
medical staffing services at VALiNTRY
Odoo POS Development Services by CandidRoot Solutions
PTS Company Brochure 2025 (1).pdf.......
CHAPTER 2 - PM Management and IT Context
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
How to Choose the Right IT Partner for Your Business in Malaysia
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Upgrade and Innovation Strategies for SAP ERP Customers
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises

Mutation-Testing mit PIT

  • 1. e-movimento Software Design & Beratung GmbH 1030 Wien ● Marxergasse 7/26 ► www.e-movimento.com Mutation-Testing mit PIT www.pitest.org
  • 2. Mutation Testing – Was?  Definition (https://en.wikipedia.org/wiki/Mutation_testing): Mutation testing (or Mutation analysis or Program mutation) is used to design new software tests and evaluate the quality of existing software tests. Mutation testing involves modifying a program in small ways. Each mutated version is called a mutant and tests detect and reject mutants by causing the behavior of the original version to differ from the mutant. This is called killing the mutant. Test suites are measured by the percentage of mutants that they kill. ► www.e-movimento.com, Sebastian Dietrich2
  • 3. Mutation Testing – Wozu?  Ziel: The purpose is to help the tester develop effective tests or locate weaknesses in the test data used for the program or in sections of the code that are seldom or never accessed during execution. Mutation testing is a form of white-box testing.  Reicht das? "Quis custodiet ipsos custodes?“ “Wer wird die Wächter selbst bewachen?“ [Juvenal, Satire 6, 347f.] ► www.e-movimento.com, Sebastian Dietrich3
  • 4.  muJava A mutation tool for Java that includes class-level operators  mutate.py A Python script to mutate C-programs  Mutator A source-based multi- language commercial mutation analyzer for concurrent Java, Ruby, JavaScript and PHP  Bacterio Mutation testing tool for multi-class Java systems  Javalanche Bytecode-based mutation testing tool for Java  Major Compiler-integrated mutation testing framework for Java  Jumble Bytecode-based mutation testing tool for Java  PIT Bytecode-based mutation testing tool for Java  Stryker Mutation testing tool for JavaScript  Mutant AST based mutation testing tool for Ruby  Jester Source-based mutation testing tool for Java  Judy Mutation testing tool for Java  Heckle Mutation testing tool for Ruby  NinjaTurtles IL-based mutation testing tool for .NET and Mono  Nester Mutation testing tool for C#  Humbug Mutation testing tool for PHP  MuCheck Mutation analysis library for Haskell Mutation Testing - PIT ► www.e-movimento.com, Sebastian Dietrich4
  • 5. PIT  Ändert Bytecode und lässt Tests laufen  Arbeitet mit ant, maven, gradle, ...  Plugins für Eclipse, IDEA, ...  Dunkelgrün = Mutation Coverage  Hellgrün = Line Coverage  Hellrot = keine Line Coverage  Dunkelrot = keine Mutation Coverage ► www.e-movimento.com, Sebastian Dietrich5
  • 6.  Conditionals Boundary: <  <=, >=  >, ...  Negate Conditionals: ==  !=, >=  <  Remove Conditionals: a == b  true  Math Mutator: +  -, &  |, <<  >>, ...  Increments Mutator: i++  i—, i--  i++  Invert Negatives: -i  i  Inline Constant: int i = 5;  int i =-1;  Return Values: return true;  return false; return x;  return x+1; return obj;  return null; return null;  RuntimeExc  Void Method Call: doSomething();  ;  Non Void Method Call: return5();  0;  Constructor Call: new Object();  null; PIT – Mutators (Auszug – in Summe 7/13) ► www.e-movimento.com, Sebastian Dietrich6
  • 7. Praxis – UnitTests eines Moduls  1.735 Tests  69,5% Coverage (lt. Sonar)  Min. 5GB RAM für Maven-Build   12857 Mutationen, davon 5312 gekillt (weil doppelt)   19.117 Tests   41% Mutation Coverage (63% Line Coverage)
  • 8. Laufzeit  mvn test  3:18 min. vs.  mvn pitest-maven:mutationCoverage  ► www.e-movimento.com, Sebastian Dietrich8
  • 9. Laufzeit – Aber...  Incremental analysis möglich (nicht getestet):  Mutation Killed, weder Test noch Klasse geändert  Mutation gilt weiterhin als gekilled  Mutation Überlebt, weder Test noch Klasse geändert, kein neuer Test covered diese Klasse  Mutation gilt weiterhin als überlebt  Mutation Killed, Klasse oder Test geändert  Mutation wird vermutlich weiterhin gekilled werden  höhere Prio  ... ► www.e-movimento.com, Sebastian Dietrich9
  • 10. Konklusio  Für Coverage-Kennzahlen größerer Module ungeeignet (da zu viel RAM nötig)  Für Build vermutlich ungeeignet (da zu langsam – incremental analysis check noch offen)  Zum Schreiben/Perfektionieren/Verbessern einzelner Unit-Tests gut geeignet  Am besten mit Plugins arbeiten ► www.e-movimento.com, Sebastian Dietrich10