SlideShare une entreprise Scribd logo
1  sur  13
Télécharger pour lire hors ligne
Mutation testing
Igor Gajowiak
July 2019
Igor Gajowiak 1 / 13
Why do we test our code ?
To ensure that code works properly
To have regression base for future development
Igor Gajowiak 2 / 13
What does test the tests ?
Code coverage index
Mutation testing ! ! !
Igor Gajowiak 3 / 13
Mutation testing
1 Prerequisites : Code base, test suite.
2 Run the test suite
3 Introduce small change to the code base - mutation
4 Run test suite
5 If the first test run succeeds and the second one not, then
it’s great !
Igor Gajowiak 4 / 13
Examples
Before :
1 f o r ( int i = 0; i < 100; ++i )
2 {
3 . . .
4 }
After :
1 f o r ( int i = 0; i > 100; ++i )
2 {
3 . . .
4 }
Igor Gajowiak 5 / 13
Examples
Before :
1 i f ( a && b)
2 {
3 c = 1;
4 }
After :
1 i f ( a | | b)
2 {
3 c = 1;
4 }
Igor Gajowiak 6 / 13
Result interpretation
Survived - tests did not detect change
Killed - tests detected change in the code
Incompetent - mutation produced flawed code
Igor Gajowiak 7 / 13
What is the goal ?
KILL THEM ALL
Igor Gajowiak 8 / 13
Code coverage vs mutation testing
Was a line executed ?
VS
Was a functionality verified ?
Igor Gajowiak 9 / 13
Examples of mutations
+ −
∗ /
< >
<
+ + i − − i
! = ==
continue break
|| &&
true false
Igor Gajowiak 10 / 13
It is time-consuming process
EXECUTION_TIME =
NUMBER_OF_MUTANTS * TEST_SUITE_EXECUTION_TIME
Solutions :
Parallelize
Write fast tests
Igor Gajowiak 11 / 13
Detecting incompetent mutants
1 while ( true )
2 {
3 . . .
4 i f ( condition )
5 {
6 break ;
7 }
8 . . .
9 }
1 while ( true )
2 {
3 . . .
4 i f ( condition )
5 {
6 continue ;
7 }
8 . . .
9 }
Igor Gajowiak 12 / 13
Stryker
Stryker - https://stryker-mutator.io
Supported mutations - https://github.com/stryker-
mutator/stryker-net/blob/master/docs/Mutators.md
Igor Gajowiak 13 / 13

Contenu connexe

Similaire à "Mutation Testing" by Igor Gajowiak

PHANTA: Diversified Test Code Quality Measurement for Modern Software Develop...
PHANTA: Diversified Test Code Quality Measurement for Modern Software Develop...PHANTA: Diversified Test Code Quality Measurement for Modern Software Develop...
PHANTA: Diversified Test Code Quality Measurement for Modern Software Develop...Susumu Tokumoto
 
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...TelecomValley
 
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Andrzej Jóźwiak
 
Bootiful Reactive Testing with Mario Gray
Bootiful Reactive Testing with Mario GrayBootiful Reactive Testing with Mario Gray
Bootiful Reactive Testing with Mario GrayVMware Tanzu
 
C++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkHumberto Marchezi
 
Google test training
Google test trainingGoogle test training
Google test trainingThierry Gayet
 
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...University of Antwerp
 
Basics of Automation & Manual Software Testing
Basics of Automation & Manual Software TestingBasics of Automation & Manual Software Testing
Basics of Automation & Manual Software TestingGusani Tech Ideation
 
Algorithm Analysis & Solution Design.pdf
Algorithm Analysis & Solution Design.pdfAlgorithm Analysis & Solution Design.pdf
Algorithm Analysis & Solution Design.pdfrony setyawansyah
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronizationcscarcas
 
Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Dror Helper
 
White-box Testing: When Quality Really Matters
White-box Testing: When Quality Really MattersWhite-box Testing: When Quality Really Matters
White-box Testing: When Quality Really MattersTechWell
 
Sbst16 tooldemo.ppt
Sbst16 tooldemo.pptSbst16 tooldemo.ppt
Sbst16 tooldemo.pptPtidej Team
 
Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Rogue Wave Software
 
Thinking in SQL with Django
Thinking in SQL with DjangoThinking in SQL with Django
Thinking in SQL with DjangoJosephZammit17
 

Similaire à "Mutation Testing" by Igor Gajowiak (20)

PHANTA: Diversified Test Code Quality Measurement for Modern Software Develop...
PHANTA: Diversified Test Code Quality Measurement for Modern Software Develop...PHANTA: Diversified Test Code Quality Measurement for Modern Software Develop...
PHANTA: Diversified Test Code Quality Measurement for Modern Software Develop...
 
Test Dependencies and the Future of Build Acceleration
Test Dependencies and the Future of Build AccelerationTest Dependencies and the Future of Build Acceleration
Test Dependencies and the Future of Build Acceleration
 
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
 
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
 
Bootiful Reactive Testing with Mario Gray
Bootiful Reactive Testing with Mario GrayBootiful Reactive Testing with Mario Gray
Bootiful Reactive Testing with Mario Gray
 
C++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing Framework
 
TDD Best Practices
TDD Best PracticesTDD Best Practices
TDD Best Practices
 
Google test training
Google test trainingGoogle test training
Google test training
 
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
 
Basics of Automation & Manual Software Testing
Basics of Automation & Manual Software TestingBasics of Automation & Manual Software Testing
Basics of Automation & Manual Software Testing
 
Algorithm Analysis & Solution Design.pdf
Algorithm Analysis & Solution Design.pdfAlgorithm Analysis & Solution Design.pdf
Algorithm Analysis & Solution Design.pdf
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization
 
Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013
 
Unit Testing in Android
Unit Testing in AndroidUnit Testing in Android
Unit Testing in Android
 
White-box Testing: When Quality Really Matters
White-box Testing: When Quality Really MattersWhite-box Testing: When Quality Really Matters
White-box Testing: When Quality Really Matters
 
Sbst16 tooldemo.ppt
Sbst16 tooldemo.pptSbst16 tooldemo.ppt
Sbst16 tooldemo.ppt
 
Sbst16 tooldemo.ppt
Sbst16 tooldemo.pptSbst16 tooldemo.ppt
Sbst16 tooldemo.ppt
 
Spock Framework
Spock FrameworkSpock Framework
Spock Framework
 
Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours?
 
Thinking in SQL with Django
Thinking in SQL with DjangoThinking in SQL with Django
Thinking in SQL with Django
 

Dernier

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 

Dernier (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 

"Mutation Testing" by Igor Gajowiak

  • 1. Mutation testing Igor Gajowiak July 2019 Igor Gajowiak 1 / 13
  • 2. Why do we test our code ? To ensure that code works properly To have regression base for future development Igor Gajowiak 2 / 13
  • 3. What does test the tests ? Code coverage index Mutation testing ! ! ! Igor Gajowiak 3 / 13
  • 4. Mutation testing 1 Prerequisites : Code base, test suite. 2 Run the test suite 3 Introduce small change to the code base - mutation 4 Run test suite 5 If the first test run succeeds and the second one not, then it’s great ! Igor Gajowiak 4 / 13
  • 5. Examples Before : 1 f o r ( int i = 0; i < 100; ++i ) 2 { 3 . . . 4 } After : 1 f o r ( int i = 0; i > 100; ++i ) 2 { 3 . . . 4 } Igor Gajowiak 5 / 13
  • 6. Examples Before : 1 i f ( a && b) 2 { 3 c = 1; 4 } After : 1 i f ( a | | b) 2 { 3 c = 1; 4 } Igor Gajowiak 6 / 13
  • 7. Result interpretation Survived - tests did not detect change Killed - tests detected change in the code Incompetent - mutation produced flawed code Igor Gajowiak 7 / 13
  • 8. What is the goal ? KILL THEM ALL Igor Gajowiak 8 / 13
  • 9. Code coverage vs mutation testing Was a line executed ? VS Was a functionality verified ? Igor Gajowiak 9 / 13
  • 10. Examples of mutations + − ∗ / < > < + + i − − i ! = == continue break || && true false Igor Gajowiak 10 / 13
  • 11. It is time-consuming process EXECUTION_TIME = NUMBER_OF_MUTANTS * TEST_SUITE_EXECUTION_TIME Solutions : Parallelize Write fast tests Igor Gajowiak 11 / 13
  • 12. Detecting incompetent mutants 1 while ( true ) 2 { 3 . . . 4 i f ( condition ) 5 { 6 break ; 7 } 8 . . . 9 } 1 while ( true ) 2 { 3 . . . 4 i f ( condition ) 5 { 6 continue ; 7 } 8 . . . 9 } Igor Gajowiak 12 / 13
  • 13. Stryker Stryker - https://stryker-mutator.io Supported mutations - https://github.com/stryker- mutator/stryker-net/blob/master/docs/Mutators.md Igor Gajowiak 13 / 13