SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
Mutation testing
with Pitest
Agenda
1) Mutation testing - definition
2) Mutators
3) Setup guide of Pitest in Maven
4) Run mutation tests
5) Pitest Coverage Report
6) Conclusions
7) References
Mutation testing
Definition
1
Definition
Mutation testing was originally proposed by Richard Lipton as a
student in 1971 and first developed and published by DeMillo,
Lipton and Sayward. The first implementation of a mutation
testing tool has been created by Timothy Budd as part of his PhD
work (titled Mutation Analysis) in 1980 from Yale University. [6]
Definition
Mutation testing is used to design new software tests and
evaluate the quality of existing software tests. Basically the idea
is about seeding artificial defects (mutations) into a source code
and checks whether your test suite finds them.
If you change the source code
▪ your test fails then mutation is killed - It’s good :)
▪ your test passes then mutation survived - It’s bad :(
Mutators
2
Mutators
Run by default by Pitest :
▪ INCREMENTS_MUTATOR
▪ CONDITIONALS_BOUNDARY_MUTATOR (e.g.)
▪ RETURN_VALS_MUTATOR
▪ VOID_METHOD_CALL_MUTATOR (e.g.)
▪ INVERT_NEGS_MUTATOR
▪ MATH_MUTATOR
▪ NEGATE_CONDITIONALS_MUTATOR (e.g.)
Conditionals Boundary
Mutator
if (a < b) {
//some code
}
mutated into
if (a <= b) {
//some code
}
Original Mutated
< <=
<= <
> >=
>= >
Negate Conditionals Mutator
if (a == b) {
//some code
}
mutated into
if (a != b) {
//some code
}
Original Mutated
== !=
!= ==
<= >
>= <
< >=
> <=
Void method call mutator
public void myMethod(int a) {
//some code
}
public int rootMethod(int x) {
myMethod(x);
return x;
}
mutated into
public void myMethod(int a) {
//some code
}
public int rootMethod(int x) {
return x;
}
Mutators
Other mutators disabled by default :
▪ CONSTRUCTOR_CALLS - replaces constructor call with null
▪ INLINE_CONSTS - assigns value to non-final variable
▪ NON_VOID_METHOD_CALLS - removes calls to non void methods
▪ REMOVE_CONDITIONALS - removes all conditionals statements
▪ EXPERIMENTAL_MEMBER_VARIABLE - removes assignments to
member variables
▪ EXPERIMENTAL_SWITCH - changes switch statement by replacing
the default label (wherever it is used) with first label. All the other
labels are replaced by the default one
Setup guide of
Pitest in Maven3
Run mutation
tests
4
Pitest
Coverage Report
6
Conclusions
7
Conclusions
Mutation testing seems powerful and research indicates that
mutation score is a better predictor of real fault detection rate
than code coverage [2]. However, it has not yet received
widespread popularity.
Creating mutations and executing tests against those mutations
is not a lightweight process and can take quite a lot of time.
In addition to finding bugs, mutation testing is a great way to
find redundant code thus making your code cleaner!
Conclusions
Should all mutants be killed ? No, but it depends.
try {
connection.close();
} catch(SQLException e){
doNext("Call DevOps & create JIRA task for Dev :)");
}
To get 100% line coverage here would mean adding a test scenario that throws an
error on connection.close() and verify the call to doNext(..). If you haven’t got it
covered, PIT will remove the call to ‘doNext’ and complain in turn that you didn’t
kill that mutant. By all means do, if your time and budget are limitless.
Remember! Mutant is only an instance in which an artificial change to your code
was not detected by your tests.
References
8
References
1) www.pitest.org
2) Are Mutants a Valid Substitute for Real Faults in Software
Testing? https://people.cs.umass.
edu/~rjust/publ/mutants_real_faults_fse_2014.pdf
3) https://blog.codecentric.de/en/2016/02/sensible-mutation-
testing-dont-go-killing-spree-2/
4) http://www.hascode.com/2015/05/mutation-testing-with-
pitest-and-maven/
5) https://gofore.com/find-bugs-mutation-testing/
6) https://en.wikipedia.org/wiki/Mutation_testing
THANKS!
Any questions ?
Thank you http://www.slidescarnival.com for layout

Mais conteúdo relacionado

Mais procurados

Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testingikhwanhayat
 
05 junit
05 junit05 junit
05 junitmha4
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven DevelopmentJohn Blum
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDDDror Helper
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration TestingDavid Berliner
 
An introduction to unit testing
An introduction to unit testingAn introduction to unit testing
An introduction to unit testingAdam Stephensen
 
Hexagonal architecture for java applications
Hexagonal architecture for java applicationsHexagonal architecture for java applications
Hexagonal architecture for java applicationsFabricio Epaminondas
 
Basic interview questions for manual testing
Basic interview questions for manual testingBasic interview questions for manual testing
Basic interview questions for manual testingJYOTI RANJAN PAL
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practicesfelixbillon
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest MatchersShai Yallin
 
Unit testing best practices
Unit testing best practicesUnit testing best practices
Unit testing best practicesnickokiss
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And MockingJoe Wilson
 

Mais procurados (20)

Unit testing with java
Unit testing with javaUnit testing with java
Unit testing with java
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testing
 
05 junit
05 junit05 junit
05 junit
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Junit
JunitJunit
Junit
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
 
Java Unit Testing
Java Unit TestingJava Unit Testing
Java Unit Testing
 
Mutation Testing
Mutation TestingMutation Testing
Mutation Testing
 
Junit
JunitJunit
Junit
 
An introduction to unit testing
An introduction to unit testingAn introduction to unit testing
An introduction to unit testing
 
Hexagonal architecture for java applications
Hexagonal architecture for java applicationsHexagonal architecture for java applications
Hexagonal architecture for java applications
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Basic interview questions for manual testing
Basic interview questions for manual testingBasic interview questions for manual testing
Basic interview questions for manual testing
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest Matchers
 
Unit testing best practices
Unit testing best practicesUnit testing best practices
Unit testing best practices
 
Workshop unit test
Workshop   unit testWorkshop   unit test
Workshop unit test
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
 

Destaque

Mutation testing
Mutation testingMutation testing
Mutation testingTao He
 
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system Tarin Gamberini
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Dockertoffermann
 
How good are your tests?
How good are your tests?How good are your tests?
How good are your tests?Noam Shaish
 
Efficient Parallel Testing with Docker
Efficient Parallel Testing with DockerEfficient Parallel Testing with Docker
Efficient Parallel Testing with DockerLaura Frank Tacho
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for TestingMukta Aphale
 
Mutagens
MutagensMutagens
MutagensUE
 
I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
I.T.A.K.E Unconference - Mutation testing to the rescue of your testsI.T.A.K.E Unconference - Mutation testing to the rescue of your tests
I.T.A.K.E Unconference - Mutation testing to the rescue of your testsNicolas Fränkel
 
Mutation
MutationMutation
Mutationankit
 
Efficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura FrankEfficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura FrankDocker, Inc.
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for TestingCarlos Sanchez
 
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDocker, Inc.
 
Kubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformKubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformLivePerson
 

Destaque (20)

Packer by HashiCorp
Packer by HashiCorpPacker by HashiCorp
Packer by HashiCorp
 
Mutation testing
Mutation testingMutation testing
Mutation testing
 
Mutation testing in Java
Mutation testing in JavaMutation testing in Java
Mutation testing in Java
 
Consul and Consul Pusher
Consul and Consul PusherConsul and Consul Pusher
Consul and Consul Pusher
 
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
MUTANTS KILLER (Revised) - PIT: state of the art of mutation testing system
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Docker
 
How good are your tests?
How good are your tests?How good are your tests?
How good are your tests?
 
Efficient Parallel Testing with Docker
Efficient Parallel Testing with DockerEfficient Parallel Testing with Docker
Efficient Parallel Testing with Docker
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
Javantura v3 - Mutation Testing for everyone – Nicolas Fränkel
Javantura v3 - Mutation Testing for everyone – Nicolas FränkelJavantura v3 - Mutation Testing for everyone – Nicolas Fränkel
Javantura v3 - Mutation Testing for everyone – Nicolas Fränkel
 
Mutagens
MutagensMutagens
Mutagens
 
I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
I.T.A.K.E Unconference - Mutation testing to the rescue of your testsI.T.A.K.E Unconference - Mutation testing to the rescue of your tests
I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
 
Mutation
MutationMutation
Mutation
 
Efficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura FrankEfficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura Frank
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
Mutation testing
Mutation testingMutation testing
Mutation testing
 
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
 
Kubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformKubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platform
 
Mutation detection methods in genetic disorders
Mutation detection methods in genetic disordersMutation detection methods in genetic disorders
Mutation detection methods in genetic disorders
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 

Semelhante a Mutation testing

Mutation Testing and MuJava
Mutation Testing and MuJavaMutation Testing and MuJava
Mutation Testing and MuJavaKrunal Parmar
 
Must.Kill.Mutants. Agile Testing Days 2017
Must.Kill.Mutants. Agile Testing Days 2017Must.Kill.Mutants. Agile Testing Days 2017
Must.Kill.Mutants. Agile Testing Days 2017Gerald Muecke
 
Mutation testing
Mutation testingMutation testing
Mutation testing기영 이
 
A MUTATION TESTING ANALYSIS AND REGRESSION TESTING
A MUTATION TESTING ANALYSIS AND REGRESSION TESTINGA MUTATION TESTING ANALYSIS AND REGRESSION TESTING
A MUTATION TESTING ANALYSIS AND REGRESSION TESTINGijfcstjournal
 
A mutation testing analysis and regression
A mutation testing analysis and regressionA mutation testing analysis and regression
A mutation testing analysis and regressionijfcstjournal
 
Mutation Testing.pdf
Mutation Testing.pdfMutation Testing.pdf
Mutation Testing.pdfKeir Bowden
 
Ôn tập kiến thức ISTQB
Ôn tập kiến thức ISTQBÔn tập kiến thức ISTQB
Ôn tập kiến thức ISTQBJenny Nguyen
 
Question ISTQB foundation 3
Question ISTQB foundation 3Question ISTQB foundation 3
Question ISTQB foundation 3Jenny Nguyen
 
DYNAMUT: A MUTATION TESTING TOOL FOR INDUSTRY-LEVEL EMBEDDED SYSTEM APPLICATIONS
DYNAMUT: A MUTATION TESTING TOOL FOR INDUSTRY-LEVEL EMBEDDED SYSTEM APPLICATIONSDYNAMUT: A MUTATION TESTING TOOL FOR INDUSTRY-LEVEL EMBEDDED SYSTEM APPLICATIONS
DYNAMUT: A MUTATION TESTING TOOL FOR INDUSTRY-LEVEL EMBEDDED SYSTEM APPLICATIONSijesajournal
 
Must.kill.mutants. TopConf Tallinn 2016
Must.kill.mutants. TopConf Tallinn 2016Must.kill.mutants. TopConf Tallinn 2016
Must.kill.mutants. TopConf Tallinn 2016Gerald Muecke
 
JS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScript
JS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScriptJS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScript
JS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScriptJSFestUA
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Qualityguest268ee8
 
Software testing and process
Software testing and processSoftware testing and process
Software testing and processgouravkalbalia
 
SE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and JunitSE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and JunitAmr E. Mohamed
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 
[Review] Predictive Mutation Testing
[Review] Predictive Mutation Testing[Review] Predictive Mutation Testing
[Review] Predictive Mutation TestingJinhan Kim
 
Fundamental of testing (what is testing)
Fundamental of testing (what is testing)Fundamental of testing (what is testing)
Fundamental of testing (what is testing)helfa safitri
 

Semelhante a Mutation testing (20)

Mutation Testing and MuJava
Mutation Testing and MuJavaMutation Testing and MuJava
Mutation Testing and MuJava
 
Must.Kill.Mutants. Agile Testing Days 2017
Must.Kill.Mutants. Agile Testing Days 2017Must.Kill.Mutants. Agile Testing Days 2017
Must.Kill.Mutants. Agile Testing Days 2017
 
Mutation-Testing mit PIT
Mutation-Testing mit PITMutation-Testing mit PIT
Mutation-Testing mit PIT
 
Mutation testing
Mutation testingMutation testing
Mutation testing
 
A MUTATION TESTING ANALYSIS AND REGRESSION TESTING
A MUTATION TESTING ANALYSIS AND REGRESSION TESTINGA MUTATION TESTING ANALYSIS AND REGRESSION TESTING
A MUTATION TESTING ANALYSIS AND REGRESSION TESTING
 
A mutation testing analysis and regression
A mutation testing analysis and regressionA mutation testing analysis and regression
A mutation testing analysis and regression
 
SAIConference_PAPER
SAIConference_PAPERSAIConference_PAPER
SAIConference_PAPER
 
Mutation Testing.pdf
Mutation Testing.pdfMutation Testing.pdf
Mutation Testing.pdf
 
Ôn tập kiến thức ISTQB
Ôn tập kiến thức ISTQBÔn tập kiến thức ISTQB
Ôn tập kiến thức ISTQB
 
Question ISTQB foundation 3
Question ISTQB foundation 3Question ISTQB foundation 3
Question ISTQB foundation 3
 
DYNAMUT: A MUTATION TESTING TOOL FOR INDUSTRY-LEVEL EMBEDDED SYSTEM APPLICATIONS
DYNAMUT: A MUTATION TESTING TOOL FOR INDUSTRY-LEVEL EMBEDDED SYSTEM APPLICATIONSDYNAMUT: A MUTATION TESTING TOOL FOR INDUSTRY-LEVEL EMBEDDED SYSTEM APPLICATIONS
DYNAMUT: A MUTATION TESTING TOOL FOR INDUSTRY-LEVEL EMBEDDED SYSTEM APPLICATIONS
 
Must.kill.mutants. TopConf Tallinn 2016
Must.kill.mutants. TopConf Tallinn 2016Must.kill.mutants. TopConf Tallinn 2016
Must.kill.mutants. TopConf Tallinn 2016
 
Introduction to JUnit
Introduction to JUnitIntroduction to JUnit
Introduction to JUnit
 
JS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScript
JS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScriptJS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScript
JS Fest 2018. Андрей Кучеренко. Мутационное тестирование в JavaScript
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
 
Software testing and process
Software testing and processSoftware testing and process
Software testing and process
 
SE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and JunitSE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and Junit
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
[Review] Predictive Mutation Testing
[Review] Predictive Mutation Testing[Review] Predictive Mutation Testing
[Review] Predictive Mutation Testing
 
Fundamental of testing (what is testing)
Fundamental of testing (what is testing)Fundamental of testing (what is testing)
Fundamental of testing (what is testing)
 

Último

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 

Último (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Mutation testing

  • 2. Agenda 1) Mutation testing - definition 2) Mutators 3) Setup guide of Pitest in Maven 4) Run mutation tests 5) Pitest Coverage Report 6) Conclusions 7) References
  • 4. Definition Mutation testing was originally proposed by Richard Lipton as a student in 1971 and first developed and published by DeMillo, Lipton and Sayward. The first implementation of a mutation testing tool has been created by Timothy Budd as part of his PhD work (titled Mutation Analysis) in 1980 from Yale University. [6]
  • 5. Definition Mutation testing is used to design new software tests and evaluate the quality of existing software tests. Basically the idea is about seeding artificial defects (mutations) into a source code and checks whether your test suite finds them. If you change the source code ▪ your test fails then mutation is killed - It’s good :) ▪ your test passes then mutation survived - It’s bad :(
  • 6.
  • 8. Mutators Run by default by Pitest : ▪ INCREMENTS_MUTATOR ▪ CONDITIONALS_BOUNDARY_MUTATOR (e.g.) ▪ RETURN_VALS_MUTATOR ▪ VOID_METHOD_CALL_MUTATOR (e.g.) ▪ INVERT_NEGS_MUTATOR ▪ MATH_MUTATOR ▪ NEGATE_CONDITIONALS_MUTATOR (e.g.)
  • 9. Conditionals Boundary Mutator if (a < b) { //some code } mutated into if (a <= b) { //some code } Original Mutated < <= <= < > >= >= >
  • 10. Negate Conditionals Mutator if (a == b) { //some code } mutated into if (a != b) { //some code } Original Mutated == != != == <= > >= < < >= > <=
  • 11. Void method call mutator public void myMethod(int a) { //some code } public int rootMethod(int x) { myMethod(x); return x; } mutated into public void myMethod(int a) { //some code } public int rootMethod(int x) { return x; }
  • 12. Mutators Other mutators disabled by default : ▪ CONSTRUCTOR_CALLS - replaces constructor call with null ▪ INLINE_CONSTS - assigns value to non-final variable ▪ NON_VOID_METHOD_CALLS - removes calls to non void methods ▪ REMOVE_CONDITIONALS - removes all conditionals statements ▪ EXPERIMENTAL_MEMBER_VARIABLE - removes assignments to member variables ▪ EXPERIMENTAL_SWITCH - changes switch statement by replacing the default label (wherever it is used) with first label. All the other labels are replaced by the default one
  • 14.
  • 16.
  • 17.
  • 19.
  • 21. Conclusions Mutation testing seems powerful and research indicates that mutation score is a better predictor of real fault detection rate than code coverage [2]. However, it has not yet received widespread popularity. Creating mutations and executing tests against those mutations is not a lightweight process and can take quite a lot of time. In addition to finding bugs, mutation testing is a great way to find redundant code thus making your code cleaner!
  • 22. Conclusions Should all mutants be killed ? No, but it depends. try { connection.close(); } catch(SQLException e){ doNext("Call DevOps & create JIRA task for Dev :)"); } To get 100% line coverage here would mean adding a test scenario that throws an error on connection.close() and verify the call to doNext(..). If you haven’t got it covered, PIT will remove the call to ‘doNext’ and complain in turn that you didn’t kill that mutant. By all means do, if your time and budget are limitless. Remember! Mutant is only an instance in which an artificial change to your code was not detected by your tests.
  • 24. References 1) www.pitest.org 2) Are Mutants a Valid Substitute for Real Faults in Software Testing? https://people.cs.umass. edu/~rjust/publ/mutants_real_faults_fse_2014.pdf 3) https://blog.codecentric.de/en/2016/02/sensible-mutation- testing-dont-go-killing-spree-2/ 4) http://www.hascode.com/2015/05/mutation-testing-with- pitest-and-maven/ 5) https://gofore.com/find-bugs-mutation-testing/ 6) https://en.wikipedia.org/wiki/Mutation_testing
  • 25. THANKS! Any questions ? Thank you http://www.slidescarnival.com for layout