SlideShare a Scribd company logo
1 of 20
ARE YOU TESTING
YOUR UNIT TESTS?
#DevoxxUK | #MutationTest @iamsoham 2
SOHAM
DASGUPTA
Father and Football lover
Tech Enthusiast/Programmer/Architect
Speaker & Blogger
Twitter : @iamsoham
LinkedIn: dasguptasoham
Github: sohamda
Medium: @iam.soham
#DevoxxUK | #MutationTest @iamsoham 3
QUICK TOUR OF
Code coverage with Unit Tests
Are you checking everything?
Mutations & Coverage
Tips & Trick
#DevoxxUK | #MutationTest @iamsoham 4
CODE COVERAGE
Code coverage, also called test coverage, is a measure of how much of the application's code has been
executed in testing
#DevoxxUK | #MutationTest @iamsoham 5
ARE YOU CHECKING EVERYTHING!
#DevoxxUK | #MutationTest @iamsoham 6
ARE YOU CHECKING EVERYTHING!
#DevoxxUK | #MutationTest @iamsoham 7
COVERAGE?
#DevoxxUK | #MutationTest @iamsoham 8
MUTATION TESTS
• Faults (or mutations) are automatically seeded
into your code, then your tests are run. If your
tests fail then the mutation is killed, if your
tests pass then the mutation lived.
• Coverage? percentage of mutations killed
Mutations
Survived Killed
Also known as Pitests
#DevoxxUK | #MutationTest @iamsoham 9
COVERAGE?
#DevoxxUK | #MutationTest @iamsoham 10
MUTATIONS?
Also known as Pitests
• Modifies your application code and runs the unit tests.
• It should produce different results and cause the unit tests to fail.
• If a unit test does not fail in this situation, it may indicate an issue with the test suite.
#DevoxxUK | #MutationTest @iamsoham 11
#DevoxxUK | #MutationTest @iamsoham 12
#DevoxxUK | #MutationTest @iamsoham 13
MUTATORS?
Conditionals Boundary
Increments
Invert Negatives
Math
Negate Conditionals
Return Values
Void Method Calls
Empty returns
False Returns
True returns
Null returns
• PIT has built-in mutators, of which most are activated by default.
• Mutations are performed on the byte code generated by the compiler rather than on the source files.
Primitive returns
Remove Conditionals
Experimental Switch
Inline Constant
Constructor Calls
Non Void Method Calls
Remove Increments
Experimental Argument Propagation
Experimental Big Integer
Experimental Member Variable
Experimental Naked Receiver
#DevoxxUK | #MutationTest @iamsoham 14
HOW TO USE IT
Intellij plugin
#DevoxxUK | #MutationTest @iamsoham 15
HOW TO USE THIS
Maven/Gradle
#DevoxxUK | #MutationTest @iamsoham 16
HOW TO USE THIS
Tips & Tricks - Maven
#DevoxxUK | #MutationTest @iamsoham 17
HOW TO USE THIS
Tips & Tricks - mvn pitest:mutationCoverage
#DevoxxUK | #MutationTest @iamsoham 18
HOW TO USE THIS
Tips & Tricks - mvn pitest:mutationCoverage
#DevoxxUK | #MutationTest @iamsoham 19
HOW TO USE THIS
Tips & Tricks - mvn pitest:mutationCoverage
This presentation contains information that may be privileged or confidential and
is the property of the Capgemini Group.
Copyright © 2022 Capgemini. All rights reserved.
About Capgemini
Capgemini is a global leader in partnering with companies to transform and manage
their business by harnessing the power of technology. The Group is guided everyday by
its purpose of unleashing human energy through technology for an inclusive and
sustainable future. It is a responsible and diverse organization of over 325,000 team
members more than 50 countries. With its strong 55-year heritage and deep industry
expertise, Capgemini is trusted by its clients to address the entire breadth of their
business needs, from strategy and design to operations, fueled by the fast evolving and
innovative world of cloud, data, AI, connectivity, software, digital engineering and
platforms. The Group reported in 2021 global revenues of €18 billion.
Get The Future You Want | www.capgemini.com

More Related Content

Similar to Are you testing your unit tests?

Automate, Create Tools, & Test Ideas Quickly with Google Apps Script
Automate, Create Tools, & Test Ideas Quickly with Google Apps ScriptAutomate, Create Tools, & Test Ideas Quickly with Google Apps Script
Automate, Create Tools, & Test Ideas Quickly with Google Apps ScriptCatalyst
 
Joker - Improve your tests with mutation testing
Joker - Improve your tests with mutation testingJoker - Improve your tests with mutation testing
Joker - Improve your tests with mutation testingNicolas Fränkel
 
Fail Safe, Fail Smart, Succeed
Fail Safe, Fail Smart, SucceedFail Safe, Fail Smart, Succeed
Fail Safe, Fail Smart, SucceedKevin Goldsmith
 
TechSEO Boost 2019: Research Competition
TechSEO Boost 2019: Research CompetitionTechSEO Boost 2019: Research Competition
TechSEO Boost 2019: Research CompetitionCatalyst
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019Paulo Clavijo
 
Get to Green: How to Safely Refactor Legacy Code
Get to Green: How to Safely Refactor Legacy CodeGet to Green: How to Safely Refactor Legacy Code
Get to Green: How to Safely Refactor Legacy CodeGene Gotimer
 
Cloudbrew 2019 observability driven development
Cloudbrew 2019   observability driven developmentCloudbrew 2019   observability driven development
Cloudbrew 2019 observability driven developmentGeert van der Cruijsen
 
Exploratory Testing with JIRA | QASymphony Webinar
Exploratory Testing with JIRA | QASymphony WebinarExploratory Testing with JIRA | QASymphony Webinar
Exploratory Testing with JIRA | QASymphony WebinarQASymphony
 
Testing your PowerShell code with Pester - Florin Loghiade
Testing your PowerShell code with Pester - Florin LoghiadeTesting your PowerShell code with Pester - Florin Loghiade
Testing your PowerShell code with Pester - Florin LoghiadeITCamp
 
Where Testers & QA Fit in the Story of DevOps
Where Testers & QA Fit in the Story of DevOpsWhere Testers & QA Fit in the Story of DevOps
Where Testers & QA Fit in the Story of DevOpsQASymphony
 
What is "Domain Driven Design" and what can you expect from it?
What is "Domain Driven Design" and what can you expect from it?What is "Domain Driven Design" and what can you expect from it?
What is "Domain Driven Design" and what can you expect from it?Tom Janssens
 
Epistemological Problem of Application Security
Epistemological Problem of Application SecurityEpistemological Problem of Application Security
Epistemological Problem of Application SecurityJames Wickett
 
TechSEO Boost - Apps script for SEOs
TechSEO Boost - Apps script for SEOsTechSEO Boost - Apps script for SEOs
TechSEO Boost - Apps script for SEOsDavid Sottimano
 
Continuous Delivery by Example
Continuous Delivery by ExampleContinuous Delivery by Example
Continuous Delivery by ExampleRafael Portela
 
Pick Any Three: Good, Fast, or Safe - Devops from Scratch
Pick Any Three: Good, Fast, or Safe - Devops from ScratchPick Any Three: Good, Fast, or Safe - Devops from Scratch
Pick Any Three: Good, Fast, or Safe - Devops from ScratchPete Cheslock
 
Trusting Your Ingredients - What Building Software And Cheesecake Have In Common
Trusting Your Ingredients - What Building Software And Cheesecake Have In CommonTrusting Your Ingredients - What Building Software And Cheesecake Have In Common
Trusting Your Ingredients - What Building Software And Cheesecake Have In CommonLeon Stigter
 
Test Estimation Hacks: Tips, Tricks and Tools Webinar
Test Estimation Hacks: Tips, Tricks and Tools WebinarTest Estimation Hacks: Tips, Tricks and Tools Webinar
Test Estimation Hacks: Tips, Tricks and Tools WebinarQASymphony
 
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya JancaDevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya JancaDevSecCon
 
QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...
QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...
QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...QASymphony
 

Similar to Are you testing your unit tests? (20)

Automate, Create Tools, & Test Ideas Quickly with Google Apps Script
Automate, Create Tools, & Test Ideas Quickly with Google Apps ScriptAutomate, Create Tools, & Test Ideas Quickly with Google Apps Script
Automate, Create Tools, & Test Ideas Quickly with Google Apps Script
 
Joker - Improve your tests with mutation testing
Joker - Improve your tests with mutation testingJoker - Improve your tests with mutation testing
Joker - Improve your tests with mutation testing
 
Fail Safe, Fail Smart, Succeed
Fail Safe, Fail Smart, SucceedFail Safe, Fail Smart, Succeed
Fail Safe, Fail Smart, Succeed
 
TechSEO Boost 2019: Research Competition
TechSEO Boost 2019: Research CompetitionTechSEO Boost 2019: Research Competition
TechSEO Boost 2019: Research Competition
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
Get to Green: How to Safely Refactor Legacy Code
Get to Green: How to Safely Refactor Legacy CodeGet to Green: How to Safely Refactor Legacy Code
Get to Green: How to Safely Refactor Legacy Code
 
Cloudbrew 2019 observability driven development
Cloudbrew 2019   observability driven developmentCloudbrew 2019   observability driven development
Cloudbrew 2019 observability driven development
 
Exploratory Testing with JIRA | QASymphony Webinar
Exploratory Testing with JIRA | QASymphony WebinarExploratory Testing with JIRA | QASymphony Webinar
Exploratory Testing with JIRA | QASymphony Webinar
 
Testing your PowerShell code with Pester - Florin Loghiade
Testing your PowerShell code with Pester - Florin LoghiadeTesting your PowerShell code with Pester - Florin Loghiade
Testing your PowerShell code with Pester - Florin Loghiade
 
Where Testers & QA Fit in the Story of DevOps
Where Testers & QA Fit in the Story of DevOpsWhere Testers & QA Fit in the Story of DevOps
Where Testers & QA Fit in the Story of DevOps
 
What is "Domain Driven Design" and what can you expect from it?
What is "Domain Driven Design" and what can you expect from it?What is "Domain Driven Design" and what can you expect from it?
What is "Domain Driven Design" and what can you expect from it?
 
Epistemological Problem of Application Security
Epistemological Problem of Application SecurityEpistemological Problem of Application Security
Epistemological Problem of Application Security
 
TechSEO Boost - Apps script for SEOs
TechSEO Boost - Apps script for SEOsTechSEO Boost - Apps script for SEOs
TechSEO Boost - Apps script for SEOs
 
Continuous Delivery by Example
Continuous Delivery by ExampleContinuous Delivery by Example
Continuous Delivery by Example
 
Pick Any Three: Good, Fast, or Safe - Devops from Scratch
Pick Any Three: Good, Fast, or Safe - Devops from ScratchPick Any Three: Good, Fast, or Safe - Devops from Scratch
Pick Any Three: Good, Fast, or Safe - Devops from Scratch
 
Trusting Your Ingredients - What Building Software And Cheesecake Have In Common
Trusting Your Ingredients - What Building Software And Cheesecake Have In CommonTrusting Your Ingredients - What Building Software And Cheesecake Have In Common
Trusting Your Ingredients - What Building Software And Cheesecake Have In Common
 
Test Estimation Hacks: Tips, Tricks and Tools Webinar
Test Estimation Hacks: Tips, Tricks and Tools WebinarTest Estimation Hacks: Tips, Tricks and Tools Webinar
Test Estimation Hacks: Tips, Tricks and Tools Webinar
 
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya JancaDevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
DevSecCon Tel Aviv 2018 - Security learns to sprint by Tanya Janca
 
QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...
QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...
QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
 

More from Soham Dasgupta

GraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptxGraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptxSoham Dasgupta
 
GraphQL-ify your API - JFall 2022
GraphQL-ify your API - JFall 2022GraphQL-ify your API - JFall 2022
GraphQL-ify your API - JFall 2022Soham Dasgupta
 
Spring Native : Why not YET!
Spring Native : Why not YET!Spring Native : Why not YET!
Spring Native : Why not YET!Soham Dasgupta
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021Soham Dasgupta
 
OneBot: A Comprehensive Case Study on Enterprise Digital Assistants
OneBot: A Comprehensive Case Study on Enterprise Digital AssistantsOneBot: A Comprehensive Case Study on Enterprise Digital Assistants
OneBot: A Comprehensive Case Study on Enterprise Digital AssistantsSoham Dasgupta
 
No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]
No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]
No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]Soham Dasgupta
 
Javascript for Enterprise Application
Javascript for Enterprise ApplicationJavascript for Enterprise Application
Javascript for Enterprise ApplicationSoham Dasgupta
 
How the Dutch Police became “Chatbot” interactive
How the Dutch Police became “Chatbot” interactiveHow the Dutch Police became “Chatbot” interactive
How the Dutch Police became “Chatbot” interactiveSoham Dasgupta
 

More from Soham Dasgupta (10)

GraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptxGraphQL_devoxx_2023.pptx
GraphQL_devoxx_2023.pptx
 
GraphQL-ify your API - JFall 2022
GraphQL-ify your API - JFall 2022GraphQL-ify your API - JFall 2022
GraphQL-ify your API - JFall 2022
 
GraphQL-ify your APIs
GraphQL-ify your APIsGraphQL-ify your APIs
GraphQL-ify your APIs
 
Spring Native : Why not YET!
Spring Native : Why not YET!Spring Native : Why not YET!
Spring Native : Why not YET!
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021
 
GraphQL-ify your APIs
GraphQL-ify your APIsGraphQL-ify your APIs
GraphQL-ify your APIs
 
OneBot: A Comprehensive Case Study on Enterprise Digital Assistants
OneBot: A Comprehensive Case Study on Enterprise Digital AssistantsOneBot: A Comprehensive Case Study on Enterprise Digital Assistants
OneBot: A Comprehensive Case Study on Enterprise Digital Assistants
 
No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]
No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]
No-Java Enterprise Applications: It’s All About JavaScript [DEV5107]
 
Javascript for Enterprise Application
Javascript for Enterprise ApplicationJavascript for Enterprise Application
Javascript for Enterprise Application
 
How the Dutch Police became “Chatbot” interactive
How the Dutch Police became “Chatbot” interactiveHow the Dutch Police became “Chatbot” interactive
How the Dutch Police became “Chatbot” interactive
 

Recently uploaded

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 

Recently uploaded (20)

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 

Are you testing your unit tests?

  • 1. ARE YOU TESTING YOUR UNIT TESTS?
  • 2. #DevoxxUK | #MutationTest @iamsoham 2 SOHAM DASGUPTA Father and Football lover Tech Enthusiast/Programmer/Architect Speaker & Blogger Twitter : @iamsoham LinkedIn: dasguptasoham Github: sohamda Medium: @iam.soham
  • 3. #DevoxxUK | #MutationTest @iamsoham 3 QUICK TOUR OF Code coverage with Unit Tests Are you checking everything? Mutations & Coverage Tips & Trick
  • 4. #DevoxxUK | #MutationTest @iamsoham 4 CODE COVERAGE Code coverage, also called test coverage, is a measure of how much of the application's code has been executed in testing
  • 5. #DevoxxUK | #MutationTest @iamsoham 5 ARE YOU CHECKING EVERYTHING!
  • 6. #DevoxxUK | #MutationTest @iamsoham 6 ARE YOU CHECKING EVERYTHING!
  • 7. #DevoxxUK | #MutationTest @iamsoham 7 COVERAGE?
  • 8. #DevoxxUK | #MutationTest @iamsoham 8 MUTATION TESTS • Faults (or mutations) are automatically seeded into your code, then your tests are run. If your tests fail then the mutation is killed, if your tests pass then the mutation lived. • Coverage? percentage of mutations killed Mutations Survived Killed Also known as Pitests
  • 9. #DevoxxUK | #MutationTest @iamsoham 9 COVERAGE?
  • 10. #DevoxxUK | #MutationTest @iamsoham 10 MUTATIONS? Also known as Pitests • Modifies your application code and runs the unit tests. • It should produce different results and cause the unit tests to fail. • If a unit test does not fail in this situation, it may indicate an issue with the test suite.
  • 13. #DevoxxUK | #MutationTest @iamsoham 13 MUTATORS? Conditionals Boundary Increments Invert Negatives Math Negate Conditionals Return Values Void Method Calls Empty returns False Returns True returns Null returns • PIT has built-in mutators, of which most are activated by default. • Mutations are performed on the byte code generated by the compiler rather than on the source files. Primitive returns Remove Conditionals Experimental Switch Inline Constant Constructor Calls Non Void Method Calls Remove Increments Experimental Argument Propagation Experimental Big Integer Experimental Member Variable Experimental Naked Receiver
  • 14. #DevoxxUK | #MutationTest @iamsoham 14 HOW TO USE IT Intellij plugin
  • 15. #DevoxxUK | #MutationTest @iamsoham 15 HOW TO USE THIS Maven/Gradle
  • 16. #DevoxxUK | #MutationTest @iamsoham 16 HOW TO USE THIS Tips & Tricks - Maven
  • 17. #DevoxxUK | #MutationTest @iamsoham 17 HOW TO USE THIS Tips & Tricks - mvn pitest:mutationCoverage
  • 18. #DevoxxUK | #MutationTest @iamsoham 18 HOW TO USE THIS Tips & Tricks - mvn pitest:mutationCoverage
  • 19. #DevoxxUK | #MutationTest @iamsoham 19 HOW TO USE THIS Tips & Tricks - mvn pitest:mutationCoverage
  • 20. This presentation contains information that may be privileged or confidential and is the property of the Capgemini Group. Copyright © 2022 Capgemini. All rights reserved. About Capgemini Capgemini is a global leader in partnering with companies to transform and manage their business by harnessing the power of technology. The Group is guided everyday by its purpose of unleashing human energy through technology for an inclusive and sustainable future. It is a responsible and diverse organization of over 325,000 team members more than 50 countries. With its strong 55-year heritage and deep industry expertise, Capgemini is trusted by its clients to address the entire breadth of their business needs, from strategy and design to operations, fueled by the fast evolving and innovative world of cloud, data, AI, connectivity, software, digital engineering and platforms. The Group reported in 2021 global revenues of €18 billion. Get The Future You Want | www.capgemini.com

Editor's Notes

  1. Traditional test coverage (i.e line, statement, branch, etc.) measures only which code is executed by your tests. It does not check that your tests are actually able to detect faults in the executed code. It is therefore only able to identify code that is definitely not tested.
  2. The default set can be overridden, and different operators selected, by passing the names of the required operators to the mutators parameter. To make configuration easier, some mutators are put together in groups. Passing the name of a group in the mutators parameter will activate all mutators of the group. . This approach has the advantage of being generally much faster and easier to incorporate into a build, but it can sometimes be difficult to simply describe how the mutation operators map to equivalent changes to a Java source file.