SlideShare a Scribd company logo
1 of 51
Download to read offline
Test amplification tutorial with DSpot
Benjamin DANGLOT
December 14th
, 2017
benjamin.danglot@inria.fr
STAMP Workshop Atos - Madrid
1/21
Use Case Example
2/21
DSpot
DSpot: Principle
Program
Test suite
3/21
DSpot: Principle
×
Program
Test suite Test criterion
3/21
DSpot: Principle
DSpot
×
Program
Test suite Test criterion
3/21
DSpot: Principle
DSpot
×
Program
Test suite Test criterion
Amplified
test suite
3/21
DSpot: Principle
DSpot
Program
Test suite Test criterion
Amplified
test suite
3/21
Use Case Example
4/21
Test Example
5/21
Test Example
In blue, the input of the test
5/21
Test Example
In blue, the input of the test
In green, an oracle of the test to verify the current behavior
5/21
How DSpot works?
6/21
DSpot: 1. Input Modification
6/21
DSpot: 1. Input Modification
Modifies the input to create new state of the program
7/21
DSpot: 1. Input Modification
Removes a method call to create a new state of the program
Remove method
call
7/21
DSpot: 1. Input Modification
Removes a method call to create a new state of the program
7/21
DSpot: 1. Input Modification
Removes a method call to create a new state of the program
Before:
benjamin.isHungry() → false
After:
benjamin.isHungry() → true
7/21
DSpot: 2. Assertion Generation
8/21
DSpot: 2. Assertion Generation
Goal: Generate assertions to verify the state of the program
1. Remove existing assertions
2. Instrument the test
3. Run Instrumented test to collect values
4. Generate assertions based on values collected
9/21
DSpot: 2. Assertion Generation
A. Removes existing assertions
10/21
DSpot: 2. Assertion Generation
assertion
removed
A. Removes existing assertions
11/21
DSpot: 2. Assertion Generation
B. Instruments the code to gather new values
12/21
DSpot: 2. Assertion Generation
B. Instruments the code to gather new values
13/21
DSpot: 2. Assertion Generation
C. Runs the instrumented test and obtains observations
14/21
DSpot: 2. Assertion Generation
C. Runs the instrumented test and obtains observations
Observations:
benjamin.isHungry() → true
benjamin.isHappy() → false
15/21
DSpot: 2. Assertion Generation
D. Generates new assertions based on observations
Observations:
benjamin.isHungry() → true
benjamin.isHappy() → false
16/21
DSpot: 2. Assertion Generation
D. Generates new assertions based on observations
Observations:
benjamin.isHungry() → true
benjamin.isHappy() → false
17/21
DSpot: Amplification of Test Results
Original test
Amplified test
18/21
DSpot: Amplification of Test Results
Original test
Method call removed
Assertion
Generated
Amplified test
18/21
DSpot: 3. Test Selection
19/21
Pre-Requisite: Mutation Analysis
Test Suite
Program
The mutation analysis computes the mutation score, a measure of the
efficiency of tests
20/21
Mutation Analysis
Test Suite
Program
Variant 1
Test Suite
Program
Variant 1
Inject Fault
First, creates variants of program by injecting faults
20/21
Mutation Analysis
Test Suite
Program
Variant 1
Variant 2
Test Suite
Program
Variant 1
Variant 2Inject Fault
Inject Fault
First, creates variants of program by injecting faults
20/21
Mutation Analysis
Test Suite
Program
Variant 1
Variant 2
Variant 3
Test Suite
Program
Variant 1
Variant 2
Variant 3
Inject Fault
Inject Fault
Inject Fault
First, creates variants of program by injecting faults
20/21
Mutation Analysis
Test Suite
Program
Variant 1
Variant 2
Variant 3Run
Run
Run
Then, runs tests against each variant
20/21
Mutation Analysis
Test Suite
Program
Variant 1
Variant 2
Variant 3Run
Run
Run
Killed
Killed
Alive
Failing test ⇔ mutant killed ⇔ behavior variation detected
20/21
Selection Of Test Using Mutation Analysis
21/21
Selection Of Test Using Mutation Analysis
21/21
Selection Of Test Using Mutation Analysis
21/21
Selection Of Test Using Mutation Analysis
21/21
Selection Of Test Using Mutation Analysis
21/21
Selection Of Test Using Mutation Analysis
21/21
Selection Of Test Using Mutation Analysis
21/21
Selection Of Test Using Mutation Analysis
21/21
DSpot: iteration
22/21
DSpot: Try it
https://github.com/danglotb/tavern
23/21
DSpot: Command Line Options
https://github.com/danglotb/tavern
• --path-to-properties
src/main/resources/tavern.properties: general description of
the project
• --iteration 2: number of time that the main loop is applied
• --test fr.inria.stamp.MainTest: full qualified name of the
test class to be amplified
• --cases test: name of the test method (test case)
• --amplifiers TestDataMutator: used input modification
• --test-criterion PitMutantScoreSelector: test criterion
selector used
• --verbose: enable more logs
• --path-pit-result mutations results/original.csv: read
mutation analysis from file to speed up the exe
24/21
Input Modification: Available Operators
• Literal Modification
1. Add/Remove/Replace a char in String
2. replace by Random String
3. +1/−1/×2/÷2 values
4. replace by random/upper bound/lower bound value
5. negate boolean
• Method Call Duplication
• Method Call Deletion
• Generation of Method Call (and required objects)
25/21
Test Selection: Available Selector
• Mutation Score
• Branch Coverage
• Instruction Coverage and Execution Path
• Behavior Changes
26/21
DSpot: Playing With Command Line Options
https://github.com/danglotb/tavern
Input Modification
--amplifiers:
• MethodAdd: duplicate
method call
• MethodRemove: remove
method call
• TestDataMutator: mutate
literals
• StatementAdd: add
method call
Compose them using ’:’
Test Criterion Selector
--test-criterion:
• PitMutantScoreSelector:
increase mutation score
• JacocoCoverageSelector:
increase coverage/exec.
path
• TakeAllSelector: take all
amplified test
You can also play with
--iteration
27/21

More Related Content

Similar to DSpot - Test Amplification for Java

Continuous test suite failure prediction
Continuous test suite failure predictionContinuous test suite failure prediction
Continuous test suite failure predictionssuser94f898
 
Towards explanations for Data-Centric AI using provenance records
Towards explanations for Data-Centric AI using provenance recordsTowards explanations for Data-Centric AI using provenance records
Towards explanations for Data-Centric AI using provenance recordsPaolo Missier
 
White Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR ChandigarhWhite Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR ChandigarhPankaj Thakur
 
SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)Amr E. Mohamed
 
CPSC 120Spring 2014Lab 5Name _____________________.docx
CPSC 120Spring 2014Lab 5Name _____________________.docxCPSC 120Spring 2014Lab 5Name _____________________.docx
CPSC 120Spring 2014Lab 5Name _____________________.docxfaithxdunce63732
 
Optimization techniques
Optimization techniquesOptimization techniques
Optimization techniquesprashik shimpi
 
Software testing ari force institute of tech.
Software testing ari force institute of tech.Software testing ari force institute of tech.
Software testing ari force institute of tech.Sanjith Ml
 
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...Work-Bench
 
A Performance Study of BDD-Based Model Checking
A Performance Study of BDD-Based Model CheckingA Performance Study of BDD-Based Model Checking
A Performance Study of BDD-Based Model CheckingOlivier Coudert
 
Csphtp1 06
Csphtp1 06Csphtp1 06
Csphtp1 06HUST
 
Mux and demux done in cadence with pics
Mux and demux done in cadence with picsMux and demux done in cadence with pics
Mux and demux done in cadence with picsdinesh aitha
 
Tech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisTech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisAdaCore
 
Using Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelinesUsing Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelinesLander Van den Bulcke
 

Similar to DSpot - Test Amplification for Java (20)

Thesis Talk
Thesis TalkThesis Talk
Thesis Talk
 
Continuous test suite failure prediction
Continuous test suite failure predictionContinuous test suite failure prediction
Continuous test suite failure prediction
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Towards explanations for Data-Centric AI using provenance records
Towards explanations for Data-Centric AI using provenance recordsTowards explanations for Data-Centric AI using provenance records
Towards explanations for Data-Centric AI using provenance records
 
White Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR ChandigarhWhite Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR Chandigarh
 
Repair dagstuhl jan2017
Repair dagstuhl jan2017Repair dagstuhl jan2017
Repair dagstuhl jan2017
 
SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)
 
CPSC 120Spring 2014Lab 5Name _____________________.docx
CPSC 120Spring 2014Lab 5Name _____________________.docxCPSC 120Spring 2014Lab 5Name _____________________.docx
CPSC 120Spring 2014Lab 5Name _____________________.docx
 
Chap07
Chap07Chap07
Chap07
 
Optimization techniques
Optimization techniquesOptimization techniques
Optimization techniques
 
Dynamic Symbolic Database Application Testing
Dynamic Symbolic Database Application TestingDynamic Symbolic Database Application Testing
Dynamic Symbolic Database Application Testing
 
Software testing ari force institute of tech.
Software testing ari force institute of tech.Software testing ari force institute of tech.
Software testing ari force institute of tech.
 
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
Nobody Knows What It’s Like To Be the Bad Man: The Development Process for th...
 
A Performance Study of BDD-Based Model Checking
A Performance Study of BDD-Based Model CheckingA Performance Study of BDD-Based Model Checking
A Performance Study of BDD-Based Model Checking
 
Csphtp1 06
Csphtp1 06Csphtp1 06
Csphtp1 06
 
rlhf.pdf
rlhf.pdfrlhf.pdf
rlhf.pdf
 
Mux and demux done in cadence with pics
Mux and demux done in cadence with picsMux and demux done in cadence with pics
Mux and demux done in cadence with pics
 
Tech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisTech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic Analysis
 
autoTVM
autoTVMautoTVM
autoTVM
 
Using Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelinesUsing Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelines
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Recently uploaded (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

DSpot - Test Amplification for Java