SlideShare a Scribd company logo
Formal Verification of Developer Tests


a Research Agenda Inspired by Mutation Testing


Serge Demeyer, Ali Parsai, Sten Vercammen, Brent van Bladel, and Mehrdad Abdi
ISoLA 2021


9th International Symposium On


Leveraging Applications of Formal Methods, Verification and Validation
ISoLA 2021 © Serge Demeyer 2
Test Automation


<<Breaking the build>>
ISoLA 2021 © Serge Demeyer 3
50%
- 75%
of code


devoted to (unit) tests!
ISoLA 2021 © Serge Demeyer 4
Supporting
Team
Functional Tests


Examples


Story Tests


Prototypes


Simulation
Exploratory Testing


Scenarios


Usability Testing


Acceptance Testing


Alpha / Beta
Unit Tests


Integration Tests
Performance Testing


Load Testing


Security Testing


“ility” Testing
Technology Facing
Business Facing
Critique
Product
Automated
& Manual
Manual
Autom
ated
Tools
ISoLA 2021 © Serge Demeyer 5
Quis custodiet ipsos custodes?


(Who will guard the guardians?)
ISoLA 2021 © Serge Demeyer 6
Quis custodiet ipsos custodes?


(Who will guard the guardians?)
Formal Verification Mutation Testing
ISoLA 2021 © Serge Demeyer 7
Quis custodiet ipsos custodes?


(Who will guard the guardians?)
Formal Verification Mutation Testing
ISoLA 2021 © Serge Demeyer
Unit Under Test
8
int findLast(std::vector<int> x, int y) {

    if (x.size() == 0)

        return -1;

    for (int i = x.size() - 1; i >= 0; i--)

        if (x[i] == y)

            return i;

    return -1;

}
y
ISoLA 2021 © Serge Demeyer
Test Suite
9
TEST(FindLastTests, emptyVector) {

    EXPECT_EQ(-1, findLast({}, 3));

}
TEST(FindLastTests, doubleOccurrence) {

    EXPECT_EQ(3, findLast({1, 2, 42, 42, 63}, 42));

}
TEST(FindLastTests, noOccurrence) {
    EXPECT_EQ(-1, findLast({1, 2, 42, 42, 63}, 99));
int findLast(std::vector<int> x, int y) {

    if (x.size() == 0)

        return -1;

    for (int i = x.size() - 1; i >= 0; i--)

        if (x[i] == y)

            return i;

    return -1;

}
ISoLA 2021 © Serge Demeyer 10
100% line coverage


100% statement coverage


100% branch coverage
all tests passed
ISoLA 2021 © Serge Demeyer
Inject Mutant (Killed)
11
01 int findLast(std::vector<int> x, int y) {

02     if (x.size() == 0)

03         return -1;

04     for (int i = x.size() - 1; i < 0; i--)

05         if (x[i] == y)

06             return i;

07     return -1;

08
}

[ PASSED ] 2 tests
.

[ FAILED ] 1 test, listed below
:

[ FAILED ] FindLastTests.doubleOccurrence
Relational Operator Replacement (ROR)


“i >= 0” becomes “i < 0”
ISoLA 2021 © Serge Demeyer
Inject Mutant (Survived - Live)
12
01 int findLast(std::vector<int> x, int y) {

02     if (x.size() == 0)

03         return -1;

04     for (int i = x.size() - 1; i > 0; i--)

05         if (x[i] == y)

06             return i;

07     return -1;

08
}

[==========] 3 tests from 1 test suite ran. (0 ms total
)

[ PASSED ] 3 tests
.

Relational Operator Replacement (ROR)


“i >= 0” becomes “i > 0”
ISoLA 2021 © Serge Demeyer
TEST(FindLastTests, occurrenceOnBoundary) {

    EXPECT_EQ(0, findLast({1, 2, 42, 42, 63}, 1));

}

[==========] 4 tests from 1 test suite ran. (0 ms total
)

[ PASSED ] 3 tests
.

[ FAILED ] 1 test, listed below
:

[ FAILED ] FindLastTests.occurrenceOnBoundar
y

Strengthening the Test Suite
13
01 int findLast(std::vector<int> x, int y) {

02     if (x.size() == 0)

03         return -1;

04     for (int i = x.size() - 1; i > 0; i--)

05         if (x[i] == y)

06             return i;

07     return -1;

08
}
ISoLA 2021 © Serge Demeyer 14
Quis custodiet ipsos custodes?


(Who will guard the guardians?)
Formal Verification Mutation Testing
ISoLA 2021 © Serge Demeyer 15
The VeriFast Program Verifier: A Tutorial
Bart Jacobs Jan Smans
Frank Piessens
imec-DistriNet, Department of Computer Science, KU Leuven - University of Leuven, Belgium
November 28, 2017
Contents
1 Introduction
2 Example: illegal access.c
3 malloc block Chunks
4 Functions and Contracts
5 Patterns
6 Predicates
7 Recursive Predicates
8 Loops
ISoLA 2021 © Serge Demeyer
Pre and postconditions
16
void stack_push(struct stack *stack, int value
)

//@ requires stack(stack, ?count)
;

//@ ensures stack(stack, count + 1)
;

{
 

//@ open stack(stack, count)
;

struct node *n = malloc(sizeof(struct node))
;

if (n == 0) { abort();
}

n->next = stack->head
;

n->value = value
;

stack->head = n
;

//@ close nodes(n, count + 1)
;

//@ close stack(stack, count + 1);
 

}

int stack_pop(struct stack *stack)

//@ requires stack(stack, ?count) &*& 0 < count
;

//@ ensures stack(stack, count - 1);
 

{
 

//@ open stack(stack, count)
;

struct node *head = stack->head
;

//@ open nodes(head, count);

int result = head->value
;

stack->head = head->next
;

free(head);
 

//@ close stack(stack, count - 1);
 

return result;
 

}
Confirm
ed


or Counterexam
ple
ISoLA 2021 © Serge Demeyer
Helpers — Intermediate Assertions
17
void stack_filter(struct stack *stack, int_predicate *p
)

//@ requires stack(stack, _) &*& is_int_predicate(p) == true
;

//@ ensures stack(stack, _);
 

{
 

//@ open stack(stack, count)
;

struct node *head = stack->head
;

//@ open nodes(head, count)
;

int result = head->value
;

stack->head = head->next
;

free(head);
 

//@ close stack(stack, count - 1);
 

//@ open stack(stack, _);
 

struct node *head = nodes_filter(stack->head, p)
;

//@ assert nodes(head, ?count)
;

stack->head = head
;

//@ open nodes(head, count);
 

//@ close nodes(head, count);
 

//@ close stack(stack, count)
;

}
 

Remove all elements where the predicate function pointer p marks false
ISoLA 2021 © Serge Demeyer 18
Quis custodiet ipsos custodes?


(Who will guard the guardians?)
Formal Verification Mutation Testing
+
ISoLA 2021 © Serge Demeyer
Equivalent Mutant
19
01 int findLast(std::vector<int> x, int y) {

02     if (x.size() <= 0)

03         return -1;

04     for (int i = x.size() - 1; i < 0; i--)

05         if (x[i] == y)

06             return i;

07     return -1;

08
}

[==========] 4 tests from 1 test suite ran. (0 ms total
)

[ PASSED ] 4 tests
.

Relational Operator Replacement (ROR)


“== 0” becomes “<= 0”
Some mutants have the same semantics as original program.


They cannot be detected by any test suite.


They waste test engineers time
ISoLA 2021 © Serge Demeyer
Verify Mutant Equivalence
20
1 int findLast(std::vector<int> x, int y)
{

2	
if (x.size() == 0) return -1
;

… (identical code here
)

9 int findLastEquivalentCandidate(std::vector<int> x, int y)
{

1
0	
if (x.size() <= 0) return -1
;

… (identical code here
)

20 TEST(FindLastTests, emptyVector)
{

2
1	
int res1, res2
;

2
2	
EXPECT_EQ(-1, res1 = findLast({}, 3))
;

2
3	
 	
//@ assert res1 == -1
;

2
4	
EXPECT_EQ(-1, res2 = findLastEquivalent({}, 3))
;

2
5	
 	
//@ assert res2 == -1
;

2
6	
 	
//@ ensures res1 == res2
;

2
7

}

Confirm
ed


or Counterexam
ple
ISoLA 2021 © Serge Demeyer
Research Agenda
21
Equivalent Mutants


Infinite Loops


Flakey Tests


Test Clones


Test Amplification
ISoLA 2021 © Serge Demeyer 22
Quis custodiet ipsos custodes?


(Who will guard the guardians?)
Testcode provides interesting
opportunities for formal verification
EXPECT_EQ ≈ ASSERT


FOCUS ANALYSIS
UNIT UNDER TEST


LIMIT SEARCH SPACE

More Related Content

What's hot

Defect effort prediction models in software
Defect effort prediction models in softwareDefect effort prediction models in software
Defect effort prediction models in software
IAEME Publication
 
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Chakkrit (Kla) Tantithamthavorn
 
Software testing lab manual
Software testing lab manualSoftware testing lab manual
Software testing lab manual
Tanzeem Syed
 
Cross-project defect prediction
Cross-project defect predictionCross-project defect prediction
Cross-project defect prediction
Thomas Zimmermann
 
Towards a Better Understanding of the Impact of Experimental Components on De...
Towards a Better Understanding of the Impact of Experimental Components on De...Towards a Better Understanding of the Impact of Experimental Components on De...
Towards a Better Understanding of the Impact of Experimental Components on De...
Chakkrit (Kla) Tantithamthavorn
 
PROPOSING AUTOMATED REGRESSION SUITE USING OPEN SOURCE TOOLS FOR A HEALTH CAR...
PROPOSING AUTOMATED REGRESSION SUITE USING OPEN SOURCE TOOLS FOR A HEALTH CAR...PROPOSING AUTOMATED REGRESSION SUITE USING OPEN SOURCE TOOLS FOR A HEALTH CAR...
PROPOSING AUTOMATED REGRESSION SUITE USING OPEN SOURCE TOOLS FOR A HEALTH CAR...
ijseajournal
 
6 article azojete vol 9 51 67
6 article azojete vol 9 51 676 article azojete vol 9 51 67
6 article azojete vol 9 51 67
Oyeniyi Samuel
 
Testing survey by_directions
Testing survey by_directionsTesting survey by_directions
Testing survey by_directions
Tao He
 
Thesis Pekka Laukkanen[1]
Thesis Pekka Laukkanen[1]Thesis Pekka Laukkanen[1]
Thesis Pekka Laukkanen[1]
Joydeep Das
 
A survey of software testing
A survey of software testingA survey of software testing
A survey of software testing
Tao He
 
Www.istqb.guru istqb question-paper5
Www.istqb.guru istqb question-paper5Www.istqb.guru istqb question-paper5
Www.istqb.guru istqb question-paper5
Tomas Vileikis
 
Multi-Objective Cross-Project Defect Prediction
Multi-Objective Cross-Project Defect PredictionMulti-Objective Cross-Project Defect Prediction
Multi-Objective Cross-Project Defect Prediction
Sebastiano Panichella
 
Impact of Coding Style Checker on Code Review -A case study on the OpenStack ...
Impact of Coding Style Checker on Code Review -A case study on the OpenStack ...Impact of Coding Style Checker on Code Review -A case study on the OpenStack ...
Impact of Coding Style Checker on Code Review -A case study on the OpenStack ...
Yuki Ueda
 
'Acceptance Test Driven Development Using Robot Framework' by Pekka Klarch & ...
'Acceptance Test Driven Development Using Robot Framework' by Pekka Klarch & ...'Acceptance Test Driven Development Using Robot Framework' by Pekka Klarch & ...
'Acceptance Test Driven Development Using Robot Framework' by Pekka Klarch & ...
TEST Huddle
 
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
Yuki Ueda
 

What's hot (15)

Defect effort prediction models in software
Defect effort prediction models in softwareDefect effort prediction models in software
Defect effort prediction models in software
 
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
 
Software testing lab manual
Software testing lab manualSoftware testing lab manual
Software testing lab manual
 
Cross-project defect prediction
Cross-project defect predictionCross-project defect prediction
Cross-project defect prediction
 
Towards a Better Understanding of the Impact of Experimental Components on De...
Towards a Better Understanding of the Impact of Experimental Components on De...Towards a Better Understanding of the Impact of Experimental Components on De...
Towards a Better Understanding of the Impact of Experimental Components on De...
 
PROPOSING AUTOMATED REGRESSION SUITE USING OPEN SOURCE TOOLS FOR A HEALTH CAR...
PROPOSING AUTOMATED REGRESSION SUITE USING OPEN SOURCE TOOLS FOR A HEALTH CAR...PROPOSING AUTOMATED REGRESSION SUITE USING OPEN SOURCE TOOLS FOR A HEALTH CAR...
PROPOSING AUTOMATED REGRESSION SUITE USING OPEN SOURCE TOOLS FOR A HEALTH CAR...
 
6 article azojete vol 9 51 67
6 article azojete vol 9 51 676 article azojete vol 9 51 67
6 article azojete vol 9 51 67
 
Testing survey by_directions
Testing survey by_directionsTesting survey by_directions
Testing survey by_directions
 
Thesis Pekka Laukkanen[1]
Thesis Pekka Laukkanen[1]Thesis Pekka Laukkanen[1]
Thesis Pekka Laukkanen[1]
 
A survey of software testing
A survey of software testingA survey of software testing
A survey of software testing
 
Www.istqb.guru istqb question-paper5
Www.istqb.guru istqb question-paper5Www.istqb.guru istqb question-paper5
Www.istqb.guru istqb question-paper5
 
Multi-Objective Cross-Project Defect Prediction
Multi-Objective Cross-Project Defect PredictionMulti-Objective Cross-Project Defect Prediction
Multi-Objective Cross-Project Defect Prediction
 
Impact of Coding Style Checker on Code Review -A case study on the OpenStack ...
Impact of Coding Style Checker on Code Review -A case study on the OpenStack ...Impact of Coding Style Checker on Code Review -A case study on the OpenStack ...
Impact of Coding Style Checker on Code Review -A case study on the OpenStack ...
 
'Acceptance Test Driven Development Using Robot Framework' by Pekka Klarch & ...
'Acceptance Test Driven Development Using Robot Framework' by Pekka Klarch & ...'Acceptance Test Driven Development Using Robot Framework' by Pekka Klarch & ...
'Acceptance Test Driven Development Using Robot Framework' by Pekka Klarch & ...
 
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
 

Similar to Formal Verification of Developer Tests: a Research Agenda Inspired by Mutation Testing

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
 
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, MelonUnit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
beITconference
 
SAST and Application Security: how to fight vulnerabilities in the code
SAST and Application Security: how to fight vulnerabilities in the codeSAST and Application Security: how to fight vulnerabilities in the code
SAST and Application Security: how to fight vulnerabilities in the code
Andrey Karpov
 
VST2022SmallAmpAmpyfier.pdf
VST2022SmallAmpAmpyfier.pdfVST2022SmallAmpAmpyfier.pdf
VST2022SmallAmpAmpyfier.pdf
University of Antwerp
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
DefconRussia
 
Checking the code of Valgrind dynamic analyzer by a static analyzer
Checking the code of Valgrind dynamic analyzer by a static analyzerChecking the code of Valgrind dynamic analyzer by a static analyzer
Checking the code of Valgrind dynamic analyzer by a static analyzer
PVS-Studio
 
"Quantum" Performance Effects
"Quantum" Performance Effects"Quantum" Performance Effects
"Quantum" Performance Effects
Sergey Kuksenko
 
"Quantum" performance effects
"Quantum" performance effects"Quantum" performance effects
"Quantum" performance effects
Sergey Kuksenko
 
Tools and Techniques for Understanding Threading Behavior in Android*
Tools and Techniques for Understanding Threading Behavior in Android*Tools and Techniques for Understanding Threading Behavior in Android*
Tools and Techniques for Understanding Threading Behavior in Android*
Intel® Software
 
Mutation @ Spotify
Mutation @ Spotify Mutation @ Spotify
Mutation @ Spotify
STAMP Project
 
Learning Dtrace
Learning DtraceLearning Dtrace
Learning Dtrace
JeongHun Byeon
 
How to apply AI to Testing
How to apply AI to TestingHow to apply AI to Testing
How to apply AI to Testing
SAP SE
 
Advances in Unit Testing: Theory and Practice
Advances in Unit Testing: Theory and PracticeAdvances in Unit Testing: Theory and Practice
Advances in Unit Testing: Theory and Practice
Tao Xie
 
Java Basics - Part1
Java Basics - Part1Java Basics - Part1
Java Basics - Part1
Vani Kandhasamy
 
White-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTestWhite-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTest
Dávid Honfi
 
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
Asuka Nakajima
 
Lecture6
Lecture6Lecture6
Lecture6
Indrasena Reddy
 
Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020
Alan Richardson
 
Session 6 sv_randomization
Session 6 sv_randomizationSession 6 sv_randomization
Session 6 sv_randomization
Nirav Desai
 
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP
 

Similar to Formal Verification of Developer Tests: a Research Agenda Inspired by Mutation Testing (20)

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...
 
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, MelonUnit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
 
SAST and Application Security: how to fight vulnerabilities in the code
SAST and Application Security: how to fight vulnerabilities in the codeSAST and Application Security: how to fight vulnerabilities in the code
SAST and Application Security: how to fight vulnerabilities in the code
 
VST2022SmallAmpAmpyfier.pdf
VST2022SmallAmpAmpyfier.pdfVST2022SmallAmpAmpyfier.pdf
VST2022SmallAmpAmpyfier.pdf
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
 
Checking the code of Valgrind dynamic analyzer by a static analyzer
Checking the code of Valgrind dynamic analyzer by a static analyzerChecking the code of Valgrind dynamic analyzer by a static analyzer
Checking the code of Valgrind dynamic analyzer by a static analyzer
 
"Quantum" Performance Effects
"Quantum" Performance Effects"Quantum" Performance Effects
"Quantum" Performance Effects
 
"Quantum" performance effects
"Quantum" performance effects"Quantum" performance effects
"Quantum" performance effects
 
Tools and Techniques for Understanding Threading Behavior in Android*
Tools and Techniques for Understanding Threading Behavior in Android*Tools and Techniques for Understanding Threading Behavior in Android*
Tools and Techniques for Understanding Threading Behavior in Android*
 
Mutation @ Spotify
Mutation @ Spotify Mutation @ Spotify
Mutation @ Spotify
 
Learning Dtrace
Learning DtraceLearning Dtrace
Learning Dtrace
 
How to apply AI to Testing
How to apply AI to TestingHow to apply AI to Testing
How to apply AI to Testing
 
Advances in Unit Testing: Theory and Practice
Advances in Unit Testing: Theory and PracticeAdvances in Unit Testing: Theory and Practice
Advances in Unit Testing: Theory and Practice
 
Java Basics - Part1
Java Basics - Part1Java Basics - Part1
Java Basics - Part1
 
White-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTestWhite-box Unit Test Generation with Microsoft IntelliTest
White-box Unit Test Generation with Microsoft IntelliTest
 
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
 
Lecture6
Lecture6Lecture6
Lecture6
 
Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020
 
Session 6 sv_randomization
Session 6 sv_randomizationSession 6 sv_randomization
Session 6 sv_randomization
 
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
 

More from University of Antwerp

MUT4SLX: Extensions for Mutation Testing of Stateflow Models
MUT4SLX: Extensions for Mutation Testing of Stateflow ModelsMUT4SLX: Extensions for Mutation Testing of Stateflow Models
MUT4SLX: Extensions for Mutation Testing of Stateflow Models
University of Antwerp
 
AI For Software Engineering: Two Industrial Experience Reports
AI For Software Engineering: Two Industrial Experience ReportsAI For Software Engineering: Two Industrial Experience Reports
AI For Software Engineering: Two Industrial Experience Reports
University of Antwerp
 
Test Amplification in Python — An Industrial Experience Report
       Test Amplification in Python — An Industrial Experience Report       Test Amplification in Python — An Industrial Experience Report
Test Amplification in Python — An Industrial Experience Report
University of Antwerp
 
Technical Debt in Start-ups / Scale-Ups
Technical Debt in Start-ups / Scale-UpsTechnical Debt in Start-ups / Scale-Ups
Technical Debt in Start-ups / Scale-Ups
University of Antwerp
 
Social Coding Platforms Facilitate Variant Forks
Social Coding Platforms Facilitate Variant ForksSocial Coding Platforms Facilitate Variant Forks
Social Coding Platforms Facilitate Variant Forks
University of Antwerp
 
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
Keynote VST2020 (Workshop on  Validation, Analysis and Evolution of Software ...Keynote VST2020 (Workshop on  Validation, Analysis and Evolution of Software ...
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
University of Antwerp
 
Saner open steeringcommittee2018campobassodoubleblind
Saner open steeringcommittee2018campobassodoubleblindSaner open steeringcommittee2018campobassodoubleblind
Saner open steeringcommittee2018campobassodoubleblind
University of Antwerp
 

More from University of Antwerp (7)

MUT4SLX: Extensions for Mutation Testing of Stateflow Models
MUT4SLX: Extensions for Mutation Testing of Stateflow ModelsMUT4SLX: Extensions for Mutation Testing of Stateflow Models
MUT4SLX: Extensions for Mutation Testing of Stateflow Models
 
AI For Software Engineering: Two Industrial Experience Reports
AI For Software Engineering: Two Industrial Experience ReportsAI For Software Engineering: Two Industrial Experience Reports
AI For Software Engineering: Two Industrial Experience Reports
 
Test Amplification in Python — An Industrial Experience Report
       Test Amplification in Python — An Industrial Experience Report       Test Amplification in Python — An Industrial Experience Report
Test Amplification in Python — An Industrial Experience Report
 
Technical Debt in Start-ups / Scale-Ups
Technical Debt in Start-ups / Scale-UpsTechnical Debt in Start-ups / Scale-Ups
Technical Debt in Start-ups / Scale-Ups
 
Social Coding Platforms Facilitate Variant Forks
Social Coding Platforms Facilitate Variant ForksSocial Coding Platforms Facilitate Variant Forks
Social Coding Platforms Facilitate Variant Forks
 
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
Keynote VST2020 (Workshop on  Validation, Analysis and Evolution of Software ...Keynote VST2020 (Workshop on  Validation, Analysis and Evolution of Software ...
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
 
Saner open steeringcommittee2018campobassodoubleblind
Saner open steeringcommittee2018campobassodoubleblindSaner open steeringcommittee2018campobassodoubleblind
Saner open steeringcommittee2018campobassodoubleblind
 

Recently uploaded

Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Top 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptxTop 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptx
devvsandy
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
Drona Infotech
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 

Recently uploaded (20)

Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Top 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptxTop 9 Trends in Cybersecurity for 2024.pptx
Top 9 Trends in Cybersecurity for 2024.pptx
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 

Formal Verification of Developer Tests: a Research Agenda Inspired by Mutation Testing

  • 1. Formal Verification of Developer Tests a Research Agenda Inspired by Mutation Testing Serge Demeyer, Ali Parsai, Sten Vercammen, Brent van Bladel, and Mehrdad Abdi ISoLA 2021 9th International Symposium On 
 Leveraging Applications of Formal Methods, Verification and Validation
  • 2. ISoLA 2021 © Serge Demeyer 2 Test Automation <<Breaking the build>>
  • 3. ISoLA 2021 © Serge Demeyer 3 50% - 75% of code devoted to (unit) tests!
  • 4. ISoLA 2021 © Serge Demeyer 4 Supporting Team Functional Tests Examples Story Tests Prototypes Simulation Exploratory Testing Scenarios Usability Testing Acceptance Testing Alpha / Beta Unit Tests Integration Tests Performance Testing Load Testing Security Testing “ility” Testing Technology Facing Business Facing Critique Product Automated & Manual Manual Autom ated Tools
  • 5. ISoLA 2021 © Serge Demeyer 5 Quis custodiet ipsos custodes? (Who will guard the guardians?)
  • 6. ISoLA 2021 © Serge Demeyer 6 Quis custodiet ipsos custodes? (Who will guard the guardians?) Formal Verification Mutation Testing
  • 7. ISoLA 2021 © Serge Demeyer 7 Quis custodiet ipsos custodes? (Who will guard the guardians?) Formal Verification Mutation Testing
  • 8. ISoLA 2021 © Serge Demeyer Unit Under Test 8 int findLast(std::vector<int> x, int y) {
     if (x.size() == 0)
         return -1;
     for (int i = x.size() - 1; i >= 0; i--)
         if (x[i] == y)
             return i;
     return -1;
 } y
  • 9. ISoLA 2021 © Serge Demeyer Test Suite 9 TEST(FindLastTests, emptyVector) {
     EXPECT_EQ(-1, findLast({}, 3));
 } TEST(FindLastTests, doubleOccurrence) {
     EXPECT_EQ(3, findLast({1, 2, 42, 42, 63}, 42));
 } TEST(FindLastTests, noOccurrence) {     EXPECT_EQ(-1, findLast({1, 2, 42, 42, 63}, 99)); int findLast(std::vector<int> x, int y) {
     if (x.size() == 0)
         return -1;
     for (int i = x.size() - 1; i >= 0; i--)
         if (x[i] == y)
             return i;
     return -1;
 }
  • 10. ISoLA 2021 © Serge Demeyer 10 100% line coverage 100% statement coverage 100% branch coverage all tests passed
  • 11. ISoLA 2021 © Serge Demeyer Inject Mutant (Killed) 11 01 int findLast(std::vector<int> x, int y) {
 02     if (x.size() == 0)
 03         return -1;
 04     for (int i = x.size() - 1; i < 0; i--)
 05         if (x[i] == y)
 06             return i;
 07     return -1;
 08 } [ PASSED ] 2 tests . [ FAILED ] 1 test, listed below : [ FAILED ] FindLastTests.doubleOccurrence Relational Operator Replacement (ROR) “i >= 0” becomes “i < 0”
  • 12. ISoLA 2021 © Serge Demeyer Inject Mutant (Survived - Live) 12 01 int findLast(std::vector<int> x, int y) {
 02     if (x.size() == 0)
 03         return -1;
 04     for (int i = x.size() - 1; i > 0; i--)
 05         if (x[i] == y)
 06             return i;
 07     return -1;
 08 } [==========] 3 tests from 1 test suite ran. (0 ms total ) [ PASSED ] 3 tests . Relational Operator Replacement (ROR) “i >= 0” becomes “i > 0”
  • 13. ISoLA 2021 © Serge Demeyer TEST(FindLastTests, occurrenceOnBoundary) {
     EXPECT_EQ(0, findLast({1, 2, 42, 42, 63}, 1));
 } [==========] 4 tests from 1 test suite ran. (0 ms total ) [ PASSED ] 3 tests . [ FAILED ] 1 test, listed below : [ FAILED ] FindLastTests.occurrenceOnBoundar y Strengthening the Test Suite 13 01 int findLast(std::vector<int> x, int y) {
 02     if (x.size() == 0)
 03         return -1;
 04     for (int i = x.size() - 1; i > 0; i--)
 05         if (x[i] == y)
 06             return i;
 07     return -1;
 08 }
  • 14. ISoLA 2021 © Serge Demeyer 14 Quis custodiet ipsos custodes? (Who will guard the guardians?) Formal Verification Mutation Testing
  • 15. ISoLA 2021 © Serge Demeyer 15 The VeriFast Program Verifier: A Tutorial Bart Jacobs Jan Smans Frank Piessens imec-DistriNet, Department of Computer Science, KU Leuven - University of Leuven, Belgium November 28, 2017 Contents 1 Introduction 2 Example: illegal access.c 3 malloc block Chunks 4 Functions and Contracts 5 Patterns 6 Predicates 7 Recursive Predicates 8 Loops
  • 16. ISoLA 2021 © Serge Demeyer Pre and postconditions 16 void stack_push(struct stack *stack, int value ) //@ requires stack(stack, ?count) ; //@ ensures stack(stack, count + 1) ; { //@ open stack(stack, count) ; struct node *n = malloc(sizeof(struct node)) ; if (n == 0) { abort(); } n->next = stack->head ; n->value = value ; stack->head = n ; //@ close nodes(n, count + 1) ; //@ close stack(stack, count + 1); } int stack_pop(struct stack *stack)
 //@ requires stack(stack, ?count) &*& 0 < count ; //@ ensures stack(stack, count - 1); { //@ open stack(stack, count) ; struct node *head = stack->head ; //@ open nodes(head, count);
 int result = head->value ; stack->head = head->next ; free(head); //@ close stack(stack, count - 1); return result; } Confirm ed or Counterexam ple
  • 17. ISoLA 2021 © Serge Demeyer Helpers — Intermediate Assertions 17 void stack_filter(struct stack *stack, int_predicate *p ) //@ requires stack(stack, _) &*& is_int_predicate(p) == true ; //@ ensures stack(stack, _); { //@ open stack(stack, count) ; struct node *head = stack->head ; //@ open nodes(head, count) ; int result = head->value ; stack->head = head->next ; free(head); //@ close stack(stack, count - 1); //@ open stack(stack, _); struct node *head = nodes_filter(stack->head, p) ; //@ assert nodes(head, ?count) ; stack->head = head ; //@ open nodes(head, count); //@ close nodes(head, count); //@ close stack(stack, count) ; } Remove all elements where the predicate function pointer p marks false
  • 18. ISoLA 2021 © Serge Demeyer 18 Quis custodiet ipsos custodes? (Who will guard the guardians?) Formal Verification Mutation Testing +
  • 19. ISoLA 2021 © Serge Demeyer Equivalent Mutant 19 01 int findLast(std::vector<int> x, int y) {
 02     if (x.size() <= 0)
 03         return -1;
 04     for (int i = x.size() - 1; i < 0; i--)
 05         if (x[i] == y)
 06             return i;
 07     return -1;
 08 } [==========] 4 tests from 1 test suite ran. (0 ms total ) [ PASSED ] 4 tests . Relational Operator Replacement (ROR) “== 0” becomes “<= 0” Some mutants have the same semantics as original program. They cannot be detected by any test suite. They waste test engineers time
  • 20. ISoLA 2021 © Serge Demeyer Verify Mutant Equivalence 20 1 int findLast(std::vector<int> x, int y) { 2 if (x.size() == 0) return -1 ; … (identical code here ) 9 int findLastEquivalentCandidate(std::vector<int> x, int y) { 1 0 if (x.size() <= 0) return -1 ; … (identical code here ) 20 TEST(FindLastTests, emptyVector) { 2 1 int res1, res2 ; 2 2 EXPECT_EQ(-1, res1 = findLast({}, 3)) ; 2 3 //@ assert res1 == -1 ; 2 4 EXPECT_EQ(-1, res2 = findLastEquivalent({}, 3)) ; 2 5 //@ assert res2 == -1 ; 2 6 //@ ensures res1 == res2 ; 2 7 } Confirm ed or Counterexam ple
  • 21. ISoLA 2021 © Serge Demeyer Research Agenda 21 Equivalent Mutants Infinite Loops Flakey Tests Test Clones Test Amplification
  • 22. ISoLA 2021 © Serge Demeyer 22 Quis custodiet ipsos custodes? (Who will guard the guardians?) Testcode provides interesting opportunities for formal verification EXPECT_EQ ≈ ASSERT FOCUS ANALYSIS UNIT UNDER TEST LIMIT SEARCH SPACE