SlideShare a Scribd company logo
1
Software Testing AMPlification
H2020 LEIT RIA - ICT-10-2016 – Software Technology
2016/12/01 – 2019/11/30
2
DevOps
3
DevOps – automatic development
unit
perf.
fuzzing
loggingdep. inj.
UI
CI
pertur-
bation
fault
recov.
IDEs
libraries
container
IDS
VMs
cluster
config.
4
DevOps – continuous testing
unit
perf.
fuzzing
logging
UI
pertur-
bation
fault
recov.
IDS
cluster
config.
5
DevOps – STAMP focus
unit
logging
config.
6
Human – bot collaboration
Collaboration
platform
pull req.
7
Human – bot collaboration
Collaboration
platform
pull req.
code
8
Human – bot collaboration
Collaboration
platform
pull req.
code
analyses
9
Human – bot collaboration
Collaboration
platform
pull req.
code
analyses
feedback
10
Human – bot collaboration
pull req.
code
analyses
feedback
11
Human – bot collaboration
Collaboration
platform
pull req.
code
analyses
feedback
12
STAMP tools
Human – bot collaboration
Collaboration
platform
pull req.
code
analyses
feedback
STAMP tools 13
DevOps – STAMP context
•Test automation
•Human – bot collaboration
14
STAMP’s concept: amplification
 Amplify (v.): to increase the size or effect of
something
https://dictionary.cambridge.org/dictionary/english/amplify
15
STAMP’s concept: amplification
 Amplify (v.): to increase the size or effect of
something
 Test amplification: Increase the effect of test
assets
16
https://dictionary.cambridge.org/dictionary/english/amplify
STAMP’s concept: amplification
 Amplify (v.): to increase the size or effect of
something
 Test amplification: Increase the effect of test
assets
 Test assets: test cases, configuration files, production logs
 Effect metrics: mutation score, feature interactions
 Automatic amplification
17
https://dictionary.cambridge.org/dictionary/english/amplify
Unit test amplification
•Premise: unit test cases exist
• Can run automatically
• Developpers capture essential behaviors and expectations
• They are not sufficient
•Intuition: unit test cases can be automatically amplified
• Automatic analysis and transformations
• Automatic assessment and selection
• In the continuous integration pipeline
18
19
@Test
factorialWith5Test() {
long obs = fact(5);
assertTrue(5 < obs);
}
@Test
factorialWith5Test() {
assertEqual(1, fact(0));}
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
20
@Test
factorialWith5Test() {
long obs = fact(5);
assertTrue(5 < obs);
}
@Test
factorialWith5Test() {
assertEqual(1, fact(0));}
Coverage
21
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
@Test
factorialWith5Test() {
long obs = fact(5);
assertTrue(5 < obs);
}
@Test
factorialWith5Test() {
assertEqual(1, fact(0));}
22
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
@Test
factorialWith5Test() {
long obs = fact(5);
assertTrue(5 < obs);
}
@Test
factorialWith5Test() {
assertEqual(1, fact(0));}
Are these test cases good at
detecting bugs?
23
@Test
factorialWith5Test() {
long obs = fact(5);
assertTrue(5 < obs);
}
@Test
factorialWith5Test() {
assertEqual(1, fact(0));}
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
Are these test cases good at
detecting bugs?
Let’s mutate our code to see.
Mutation analysis
•Tests are good if they can detect bugs
•Principle: generate bugs and test the tests
• Conditions
• Constants
• Return
• Delete method calls
• Constructor call
24
long fact(int n) {
if(n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
25
long fact(int n) {
if(n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
26
n != 0 return 1+1
< --!(i<=n)
result/i
result+1
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
27
n != 0 return 1+1
< --!(i<=n)
result/i
result+1
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
28
@Test
factorialWith5Test() {
long obs = fact(5);
assertTrue(5 < obs); }
n != 0 return 1+1
< --!(i<=n)
result/i
result+1
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
29
@Test
factorialWith5Test() {
long obs = fact(5);
assertTrue(5 < obs); }
@Test
factorialWith5Test() {
assertEqual(1, fact(0));}
n != 0 return 1+1
< --!(i<=n)
result/i
result+1
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
Mutation reveals bugs in the test suite
30
@Test
factorialWith5Test() {
long obs = fact(5);
assertTrue(5 < obs); }
@Test
factorialWith5Test() {
assertEqual(1, fact(0));}
Bugs in the test suite:
- Weak oracle
- Missing input
n != 0 return 1+1
< --!(i<=n)
result/i
result+1
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
31
@Test
factorialWith5Test() {
long obs = fact(5);
assertEqual(120, obs); }
@Test
factorialWith5Test() {
assertEqual(1, fact(0));}
@Test
factorialWith1Test() {
assertEqual(1, fact(1));}
n != 0 return 1+1
< --!(i<=n)
result/i
result+1
Descartes – extreme Java
mutation
32
Descartes
•Mutation operators: extreme mutation
•Active, open source development
•Pitest plugin
•Compared to PIT
• Less mutants
• Different type of feedback
• Same framework
33
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
Descartes - example
34
long fact(int n) {
if (n == 0)return 1;
long result = 1;
for(int i=2; i<=n; i++)
result = result * i;
return result;}
Descartes - example
35
long fact(int n){
return 0;}
long fact(int n){
return 1;}
PIT : 7 mutants
Descartes : 2 mutants
Assess test cases effectiveness
36Apache Commons Collections
class SingletonListIterator
implements Iterator<Node> {
...
void add() {
throw
new UnsupportedOperationException();
}
...
}
Assess test cases effectiveness
37Apache Commons Collections
@Test
void testAdd() {
SingletonListIterator it = ...;
try {
it.add(value);
}
catch(Exception ex) {}
class SingletonListIterator
implements Iterator<Node> {
void add() {
throw
new UnsupportedOperationException();
}
}
Assess test cases effectiveness
38Apache Commons Collections
@Test
void testAdd() {
SingletonListIterator it = ...;
try {
it.add(value);
}
catch(Exception ex) {}
class SingletonListIterator
implements Iterator<Node> {
void add() {
throw
new UnsupportedOperationException();
}
}
✔
Descartes
39Apache Commons Collections
@Test
void testAdd() {
SingletonListIterator it = ...;
try {
it.add(value);
}
catch(Exception ex) {}
class SingletonListIterator
implements Iterator<Node> {
void add() {
}
}
Remove the whole body of method
Descartes
40Apache Commons Collections
@Test
void testAdd() {
SingletonListIterator it = ...;
try {
it.add(value);
}
catch(Exception ex) {}
class SingletonListIterator
implements Iterator<Node> {
void add() {
}
}
✔
Descartes
41Apache Commons Collections
@Test
void testAdd() {
SingletonListIterator it = ...;
try {
it.add(value);
}
catch(Exception ex) {}
class SingletonListIterator
implements Iterator<Node> {
void add() {
}
}
✔Pseudo-tested
method
Descartes
42Apache Commons Collections
@Test
void testAdd() {
SingletonListIterator it = ...;
try {
it.add(value);
}
catch(Exception ex) {}
class SingletonListIterator
implements Iterator<Node> {
void add() {
}
}
✔Pseudo-tested
method
No exception is thrown
A fail is needed here
Descartes
43
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.4.0</version>
<dependencies>
<dependency>
<groupId>eu.stamp-project</groupId>
<artifactId>descartes</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<configuration>
<verbose>true</verbose>
<mutationEngine>descartes</mutationEngine>
<mutators>
<mutator>true</mutator>
<mutator>”A string”</mutator>
<mutator>null</mutator>
<mutator>empty</mutator>
</mutators>
<outputFormats>
<value>ISSUES</value>
<value>METHODS</value>
<value>JSON</value>
</outputFormats>
</configuration>
</plugin>
</plugins>
PITest as a plugin
Descartes to be used by PITest
Regular PITest configuration
Descartes as the mutation engine
Values to use in extreme transforms. Supports literals for
primitive types, String, null and empty for empty arrays.
Reporting options. Custom reports ISSUES and METHODS for
testing issues and method categorization. JSON, HTML, XML
for regular PITest report.
45
public void testIterationOrder() {
for (int size = 1; size < 1000; size++) {
List<Integer> other = new ArrayList<Integer>(size);
for (int i = 0; i < size; i++) {other.add(i);}
TreeList<Integer> l = new TreeList<Integer>(other);
ListIterator<Integer> it = l.listIterator();
int i = 0;
while (it.hasNext()) {
Integer val = it.next();
assertEquals(i++, val.intValue());
}
}
}
Original test case input
(data and functions)
oracle
(expected properties)
Benoit Baudry, KTH, ICES DevOps 46
Unit testing
Benoit Baudry, KTH, ICES DevOps
P
state
Input space Observation space
47
Unit test amplification
Benoit Baudry, KTH, ICES DevOps
P
state
Input space Observation space
48
49
@Test
public void html() {
Attribute attr = new Attribute("key", "value &");
assertEquals("key="value &"", attr.html());
assertEquals(attr.html(), attr.toString());
}
50
@Test
public void html() {
Attribute attr = new Attribute("key", "value &");
assertEquals("key="value &"", attr.html());
assertEquals(attr.html(), attr.toString());
}
@Test
public void html_add33() throws Exception {
Attribute attr = new Attribute("key", "value &");
Assert.assertEquals("key="value &"", attr.html());
Assert.assertEquals("key="value &"", attr.toString());
Assert.assertEquals("key", attr.getKey());
Assert.assertEquals("value &", attr.getValue());
}
51
52
53
DSpot
Automatic Test Improvement with DSpot: a Study with Ten Mature Open-Source Projects. B. Danglot, O. Luis Vera-Pérez, B. Baudry, M. Monperrus. Submitted to EMSE.
Test amplification
•Descartes: spots weak tests
•Dspot: suggests improvements of existing tests
•Available as Maven plugins
•Method
• Developer machine
• In the CI
•Future work
• Integration in PR-based development
• Develop work on advanced Maven dependency management
54
Open source tooling
•https://github.com/STAMP-project/pitest-descartes
•https://github.com/STAMP-project/dspot
•Two Maven plugins
55
More information
• An Approach and Benchmark to Detect Behavioral Changes of
Commits in Continuous Integration
• https://arxiv.org/pdf/1902.08482
• Automatic Test Improvement with DSpot: a Study with Ten Mature
Open-Source Projects
• https://arxiv.org/pdf/1811.08330
• A Comprehensive Study of Pseudo-tested Methods
• https://arxiv.org/pdf/1807.05030
• http://stamp-project.eu/
• https://github.com/KTH/devops-course/
• baudry@kth.se
56
•4 res. institutions
•5 companies
•1 open source
consortium
•516 p.m
•To increase test
automation in
DevOps

More Related Content

What's hot

Fnt software solutions placement paper
Fnt software solutions placement paperFnt software solutions placement paper
Fnt software solutions placement paperfntsofttech
 
Introduzione al TDD
Introduzione al TDDIntroduzione al TDD
Introduzione al TDD
Andrea Francia
 
Automated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and ValidationAutomated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and Validation
Barbara Jones
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockRobot Media
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
Dror Helper
 
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDKEric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
GuardSquare
 
ITT 2014 - Eric Lafortune - ProGuard, Optimizer and Obfuscator in the Android...
ITT 2014 - Eric Lafortune - ProGuard, Optimizer and Obfuscator in the Android...ITT 2014 - Eric Lafortune - ProGuard, Optimizer and Obfuscator in the Android...
ITT 2014 - Eric Lafortune - ProGuard, Optimizer and Obfuscator in the Android...
Istanbul Tech Talks
 
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMEREVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
Andrey Karpov
 
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
 
JUnit Pioneer
JUnit PioneerJUnit Pioneer
JUnit Pioneer
Scott Leberknight
 
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
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
ICS
 
Eric Lafortune - ProGuard and DexGuard for optimization and protection
Eric Lafortune - ProGuard and DexGuard for optimization and protectionEric Lafortune - ProGuard and DexGuard for optimization and protection
Eric Lafortune - ProGuard and DexGuard for optimization and protection
GuardSquare
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujei
gersonjack
 
Mutation Testing: Start Hunting The Bugs
Mutation Testing: Start Hunting The BugsMutation Testing: Start Hunting The Bugs
Mutation Testing: Start Hunting The Bugs
Ari Waller
 
Repair dagstuhl jan2017
Repair dagstuhl jan2017Repair dagstuhl jan2017
Repair dagstuhl jan2017
Abhik Roychoudhury
 
Make Testing Groovy
Make Testing GroovyMake Testing Groovy
Make Testing Groovy
Paul King
 
GMock framework
GMock frameworkGMock framework
GMock framework
corehard_by
 
Test driven development
Test driven developmentTest driven development
Test driven developmentJohn Walsh
 
MUTANTS KILLER - PIT: state of the art of mutation testing system
MUTANTS KILLER - PIT: state of the art of mutation testing system MUTANTS KILLER - PIT: state of the art of mutation testing system
MUTANTS KILLER - PIT: state of the art of mutation testing system
Tarin Gamberini
 

What's hot (20)

Fnt software solutions placement paper
Fnt software solutions placement paperFnt software solutions placement paper
Fnt software solutions placement paper
 
Introduzione al TDD
Introduzione al TDDIntroduzione al TDD
Introduzione al TDD
 
Automated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and ValidationAutomated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and Validation
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
 
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDKEric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
 
ITT 2014 - Eric Lafortune - ProGuard, Optimizer and Obfuscator in the Android...
ITT 2014 - Eric Lafortune - ProGuard, Optimizer and Obfuscator in the Android...ITT 2014 - Eric Lafortune - ProGuard, Optimizer and Obfuscator in the Android...
ITT 2014 - Eric Lafortune - ProGuard, Optimizer and Obfuscator in the Android...
 
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMEREVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
 
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*
 
JUnit Pioneer
JUnit PioneerJUnit Pioneer
JUnit Pioneer
 
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
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
 
Eric Lafortune - ProGuard and DexGuard for optimization and protection
Eric Lafortune - ProGuard and DexGuard for optimization and protectionEric Lafortune - ProGuard and DexGuard for optimization and protection
Eric Lafortune - ProGuard and DexGuard for optimization and protection
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujei
 
Mutation Testing: Start Hunting The Bugs
Mutation Testing: Start Hunting The BugsMutation Testing: Start Hunting The Bugs
Mutation Testing: Start Hunting The Bugs
 
Repair dagstuhl jan2017
Repair dagstuhl jan2017Repair dagstuhl jan2017
Repair dagstuhl jan2017
 
Make Testing Groovy
Make Testing GroovyMake Testing Groovy
Make Testing Groovy
 
GMock framework
GMock frameworkGMock framework
GMock framework
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
MUTANTS KILLER - PIT: state of the art of mutation testing system
MUTANTS KILLER - PIT: state of the art of mutation testing system MUTANTS KILLER - PIT: state of the art of mutation testing system
MUTANTS KILLER - PIT: state of the art of mutation testing system
 

Similar to STAMP Descartes Presentation

The CI as a partner for test improvement suggestions
The CI as a partner for test improvement suggestionsThe CI as a partner for test improvement suggestions
The CI as a partner for test improvement suggestions
Caroline Landry
 
Best practices unit testing
Best practices unit testing Best practices unit testing
Best practices unit testing
Tricode (part of Dept)
 
DSR Testing (Part 1)
DSR Testing (Part 1)DSR Testing (Part 1)
DSR Testing (Part 1)
Steve Upton
 
Agile mobile
Agile mobileAgile mobile
Agile mobile
Godfrey Nolan
 
TestNG vs Junit
TestNG vs JunitTestNG vs Junit
TestNG vs Junit
Büşra İçöz
 
Mutation testing
Mutation testingMutation testing
Mutation testing
기영 이
 
05 junit
05 junit05 junit
05 junit
mha4
 
Unit Testing - Nakov's Talk @ VarnaConf 2013
Unit Testing - Nakov's Talk @ VarnaConf 2013Unit Testing - Nakov's Talk @ VarnaConf 2013
Unit Testing - Nakov's Talk @ VarnaConf 2013
Svetlin Nakov
 
Unit testing by Svetlin Nakov
Unit testing by Svetlin NakovUnit testing by Svetlin Nakov
Unit testing by Svetlin Nakov
it-tour
 
Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4
jeresig
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Comunidade NetPonto
 
Turbinando o compilador do Java 8
Turbinando o compilador do Java 8Turbinando o compilador do Java 8
Turbinando o compilador do Java 8
Marcelo de Castro
 
Mutation testing Bucharest Tech Week
Mutation testing Bucharest Tech WeekMutation testing Bucharest Tech Week
Mutation testing Bucharest Tech Week
Paco van Beckhoven
 
Be smart when testing your Akka code
Be smart when testing your Akka codeBe smart when testing your Akka code
Be smart when testing your Akka code
Mykhailo Kotsur
 
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
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
jeresig
 
Mutate and Test your Tests
Mutate and Test your TestsMutate and Test your Tests
Mutate and Test your Tests
STAMP Project
 
Junit 4.0
Junit 4.0Junit 4.0
Golang dot-testing-lite
Golang dot-testing-liteGolang dot-testing-lite
Golang dot-testing-lite
Richárd Kovács
 
Unit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran JanardhanaUnit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran Janardhana
Ravikiran J
 

Similar to STAMP Descartes Presentation (20)

The CI as a partner for test improvement suggestions
The CI as a partner for test improvement suggestionsThe CI as a partner for test improvement suggestions
The CI as a partner for test improvement suggestions
 
Best practices unit testing
Best practices unit testing Best practices unit testing
Best practices unit testing
 
DSR Testing (Part 1)
DSR Testing (Part 1)DSR Testing (Part 1)
DSR Testing (Part 1)
 
Agile mobile
Agile mobileAgile mobile
Agile mobile
 
TestNG vs Junit
TestNG vs JunitTestNG vs Junit
TestNG vs Junit
 
Mutation testing
Mutation testingMutation testing
Mutation testing
 
05 junit
05 junit05 junit
05 junit
 
Unit Testing - Nakov's Talk @ VarnaConf 2013
Unit Testing - Nakov's Talk @ VarnaConf 2013Unit Testing - Nakov's Talk @ VarnaConf 2013
Unit Testing - Nakov's Talk @ VarnaConf 2013
 
Unit testing by Svetlin Nakov
Unit testing by Svetlin NakovUnit testing by Svetlin Nakov
Unit testing by Svetlin Nakov
 
Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
 
Turbinando o compilador do Java 8
Turbinando o compilador do Java 8Turbinando o compilador do Java 8
Turbinando o compilador do Java 8
 
Mutation testing Bucharest Tech Week
Mutation testing Bucharest Tech WeekMutation testing Bucharest Tech Week
Mutation testing Bucharest Tech Week
 
Be smart when testing your Akka code
Be smart when testing your Akka codeBe smart when testing your Akka code
Be smart when testing your Akka code
 
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
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 
Mutate and Test your Tests
Mutate and Test your TestsMutate and Test your Tests
Mutate and Test your Tests
 
Junit 4.0
Junit 4.0Junit 4.0
Junit 4.0
 
Golang dot-testing-lite
Golang dot-testing-liteGolang dot-testing-lite
Golang dot-testing-lite
 
Unit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran JanardhanaUnit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran Janardhana
 

More from STAMP Project

Mutation Testing Workshop at Ericsson, Kista, Sweden
Mutation Testing Workshop at Ericsson, Kista, SwedenMutation Testing Workshop at Ericsson, Kista, Sweden
Mutation Testing Workshop at Ericsson, Kista, Sweden
STAMP Project
 
STAMP Project at Telecom Valley 6 Dec. 2018
STAMP Project at Telecom Valley 6 Dec. 2018STAMP Project at Telecom Valley 6 Dec. 2018
STAMP Project at Telecom Valley 6 Dec. 2018
STAMP Project
 
STAMP ActiveEon Use Case at Telecom Valley Dec. 2018
STAMP ActiveEon Use Case at Telecom Valley Dec. 2018STAMP ActiveEon Use Case at Telecom Valley Dec. 2018
STAMP ActiveEon Use Case at Telecom Valley Dec. 2018
STAMP Project
 
20181106 arie van_deursen_testday2018
20181106 arie van_deursen_testday201820181106 arie van_deursen_testday2018
20181106 arie van_deursen_testday2018
STAMP Project
 
1803_STAMP_OpenCloudForum2018
1803_STAMP_OpenCloudForum20181803_STAMP_OpenCloudForum2018
1803_STAMP_OpenCloudForum2018
STAMP Project
 
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
STAMP Project
 
Stamp Project presentation at OW2con'17
Stamp Project presentation at OW2con'17Stamp Project presentation at OW2con'17
Stamp Project presentation at OW2con'17
STAMP Project
 
STAMP at Open Cloud Forum by OW2 2017
STAMP at Open Cloud Forum by OW2 2017STAMP at Open Cloud Forum by OW2 2017
STAMP at Open Cloud Forum by OW2 2017
STAMP Project
 

More from STAMP Project (8)

Mutation Testing Workshop at Ericsson, Kista, Sweden
Mutation Testing Workshop at Ericsson, Kista, SwedenMutation Testing Workshop at Ericsson, Kista, Sweden
Mutation Testing Workshop at Ericsson, Kista, Sweden
 
STAMP Project at Telecom Valley 6 Dec. 2018
STAMP Project at Telecom Valley 6 Dec. 2018STAMP Project at Telecom Valley 6 Dec. 2018
STAMP Project at Telecom Valley 6 Dec. 2018
 
STAMP ActiveEon Use Case at Telecom Valley Dec. 2018
STAMP ActiveEon Use Case at Telecom Valley Dec. 2018STAMP ActiveEon Use Case at Telecom Valley Dec. 2018
STAMP ActiveEon Use Case at Telecom Valley Dec. 2018
 
20181106 arie van_deursen_testday2018
20181106 arie van_deursen_testday201820181106 arie van_deursen_testday2018
20181106 arie van_deursen_testday2018
 
1803_STAMP_OpenCloudForum2018
1803_STAMP_OpenCloudForum20181803_STAMP_OpenCloudForum2018
1803_STAMP_OpenCloudForum2018
 
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
 
Stamp Project presentation at OW2con'17
Stamp Project presentation at OW2con'17Stamp Project presentation at OW2con'17
Stamp Project presentation at OW2con'17
 
STAMP at Open Cloud Forum by OW2 2017
STAMP at Open Cloud Forum by OW2 2017STAMP at Open Cloud Forum by OW2 2017
STAMP at Open Cloud Forum by OW2 2017
 

Recently uploaded

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 

Recently uploaded (20)

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 

STAMP Descartes Presentation

  • 1. 1
  • 2. Software Testing AMPlification H2020 LEIT RIA - ICT-10-2016 – Software Technology 2016/12/01 – 2019/11/30 2
  • 4. DevOps – automatic development unit perf. fuzzing loggingdep. inj. UI CI pertur- bation fault recov. IDEs libraries container IDS VMs cluster config. 4
  • 5. DevOps – continuous testing unit perf. fuzzing logging UI pertur- bation fault recov. IDS cluster config. 5
  • 6. DevOps – STAMP focus unit logging config. 6
  • 7. Human – bot collaboration Collaboration platform pull req. 7
  • 8. Human – bot collaboration Collaboration platform pull req. code 8
  • 9. Human – bot collaboration Collaboration platform pull req. code analyses 9
  • 10. Human – bot collaboration Collaboration platform pull req. code analyses feedback 10
  • 11. Human – bot collaboration pull req. code analyses feedback 11
  • 12. Human – bot collaboration Collaboration platform pull req. code analyses feedback 12 STAMP tools
  • 13. Human – bot collaboration Collaboration platform pull req. code analyses feedback STAMP tools 13
  • 14. DevOps – STAMP context •Test automation •Human – bot collaboration 14
  • 15. STAMP’s concept: amplification  Amplify (v.): to increase the size or effect of something https://dictionary.cambridge.org/dictionary/english/amplify 15
  • 16. STAMP’s concept: amplification  Amplify (v.): to increase the size or effect of something  Test amplification: Increase the effect of test assets 16 https://dictionary.cambridge.org/dictionary/english/amplify
  • 17. STAMP’s concept: amplification  Amplify (v.): to increase the size or effect of something  Test amplification: Increase the effect of test assets  Test assets: test cases, configuration files, production logs  Effect metrics: mutation score, feature interactions  Automatic amplification 17 https://dictionary.cambridge.org/dictionary/english/amplify
  • 18. Unit test amplification •Premise: unit test cases exist • Can run automatically • Developpers capture essential behaviors and expectations • They are not sufficient •Intuition: unit test cases can be automatically amplified • Automatic analysis and transformations • Automatic assessment and selection • In the continuous integration pipeline 18
  • 19. 19 @Test factorialWith5Test() { long obs = fact(5); assertTrue(5 < obs); } @Test factorialWith5Test() { assertEqual(1, fact(0));}
  • 20. long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} 20 @Test factorialWith5Test() { long obs = fact(5); assertTrue(5 < obs); } @Test factorialWith5Test() { assertEqual(1, fact(0));}
  • 21. Coverage 21 long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} @Test factorialWith5Test() { long obs = fact(5); assertTrue(5 < obs); } @Test factorialWith5Test() { assertEqual(1, fact(0));}
  • 22. 22 long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} @Test factorialWith5Test() { long obs = fact(5); assertTrue(5 < obs); } @Test factorialWith5Test() { assertEqual(1, fact(0));} Are these test cases good at detecting bugs?
  • 23. 23 @Test factorialWith5Test() { long obs = fact(5); assertTrue(5 < obs); } @Test factorialWith5Test() { assertEqual(1, fact(0));} long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} Are these test cases good at detecting bugs? Let’s mutate our code to see.
  • 24. Mutation analysis •Tests are good if they can detect bugs •Principle: generate bugs and test the tests • Conditions • Constants • Return • Delete method calls • Constructor call 24
  • 25. long fact(int n) { if(n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} 25
  • 26. long fact(int n) { if(n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} 26 n != 0 return 1+1 < --!(i<=n) result/i result+1
  • 27. long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} 27 n != 0 return 1+1 < --!(i<=n) result/i result+1
  • 28. long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} 28 @Test factorialWith5Test() { long obs = fact(5); assertTrue(5 < obs); } n != 0 return 1+1 < --!(i<=n) result/i result+1
  • 29. long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} 29 @Test factorialWith5Test() { long obs = fact(5); assertTrue(5 < obs); } @Test factorialWith5Test() { assertEqual(1, fact(0));} n != 0 return 1+1 < --!(i<=n) result/i result+1
  • 30. long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} Mutation reveals bugs in the test suite 30 @Test factorialWith5Test() { long obs = fact(5); assertTrue(5 < obs); } @Test factorialWith5Test() { assertEqual(1, fact(0));} Bugs in the test suite: - Weak oracle - Missing input n != 0 return 1+1 < --!(i<=n) result/i result+1
  • 31. long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} 31 @Test factorialWith5Test() { long obs = fact(5); assertEqual(120, obs); } @Test factorialWith5Test() { assertEqual(1, fact(0));} @Test factorialWith1Test() { assertEqual(1, fact(1));} n != 0 return 1+1 < --!(i<=n) result/i result+1
  • 32. Descartes – extreme Java mutation 32
  • 33. Descartes •Mutation operators: extreme mutation •Active, open source development •Pitest plugin •Compared to PIT • Less mutants • Different type of feedback • Same framework 33
  • 34. long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} Descartes - example 34
  • 35. long fact(int n) { if (n == 0)return 1; long result = 1; for(int i=2; i<=n; i++) result = result * i; return result;} Descartes - example 35 long fact(int n){ return 0;} long fact(int n){ return 1;} PIT : 7 mutants Descartes : 2 mutants
  • 36. Assess test cases effectiveness 36Apache Commons Collections class SingletonListIterator implements Iterator<Node> { ... void add() { throw new UnsupportedOperationException(); } ... }
  • 37. Assess test cases effectiveness 37Apache Commons Collections @Test void testAdd() { SingletonListIterator it = ...; try { it.add(value); } catch(Exception ex) {} class SingletonListIterator implements Iterator<Node> { void add() { throw new UnsupportedOperationException(); } }
  • 38. Assess test cases effectiveness 38Apache Commons Collections @Test void testAdd() { SingletonListIterator it = ...; try { it.add(value); } catch(Exception ex) {} class SingletonListIterator implements Iterator<Node> { void add() { throw new UnsupportedOperationException(); } } ✔
  • 39. Descartes 39Apache Commons Collections @Test void testAdd() { SingletonListIterator it = ...; try { it.add(value); } catch(Exception ex) {} class SingletonListIterator implements Iterator<Node> { void add() { } } Remove the whole body of method
  • 40. Descartes 40Apache Commons Collections @Test void testAdd() { SingletonListIterator it = ...; try { it.add(value); } catch(Exception ex) {} class SingletonListIterator implements Iterator<Node> { void add() { } } ✔
  • 41. Descartes 41Apache Commons Collections @Test void testAdd() { SingletonListIterator it = ...; try { it.add(value); } catch(Exception ex) {} class SingletonListIterator implements Iterator<Node> { void add() { } } ✔Pseudo-tested method
  • 42. Descartes 42Apache Commons Collections @Test void testAdd() { SingletonListIterator it = ...; try { it.add(value); } catch(Exception ex) {} class SingletonListIterator implements Iterator<Node> { void add() { } } ✔Pseudo-tested method No exception is thrown A fail is needed here
  • 44. <plugins> <plugin> <groupId>org.pitest</groupId> <artifactId>pitest-maven</artifactId> <version>1.4.0</version> <dependencies> <dependency> <groupId>eu.stamp-project</groupId> <artifactId>descartes</artifactId> <version>1.2</version> </dependency> </dependencies> <configuration> <verbose>true</verbose> <mutationEngine>descartes</mutationEngine> <mutators> <mutator>true</mutator> <mutator>”A string”</mutator> <mutator>null</mutator> <mutator>empty</mutator> </mutators> <outputFormats> <value>ISSUES</value> <value>METHODS</value> <value>JSON</value> </outputFormats> </configuration> </plugin> </plugins> PITest as a plugin Descartes to be used by PITest Regular PITest configuration Descartes as the mutation engine Values to use in extreme transforms. Supports literals for primitive types, String, null and empty for empty arrays. Reporting options. Custom reports ISSUES and METHODS for testing issues and method categorization. JSON, HTML, XML for regular PITest report.
  • 45. 45
  • 46. public void testIterationOrder() { for (int size = 1; size < 1000; size++) { List<Integer> other = new ArrayList<Integer>(size); for (int i = 0; i < size; i++) {other.add(i);} TreeList<Integer> l = new TreeList<Integer>(other); ListIterator<Integer> it = l.listIterator(); int i = 0; while (it.hasNext()) { Integer val = it.next(); assertEquals(i++, val.intValue()); } } } Original test case input (data and functions) oracle (expected properties) Benoit Baudry, KTH, ICES DevOps 46
  • 47. Unit testing Benoit Baudry, KTH, ICES DevOps P state Input space Observation space 47
  • 48. Unit test amplification Benoit Baudry, KTH, ICES DevOps P state Input space Observation space 48
  • 49. 49 @Test public void html() { Attribute attr = new Attribute("key", "value &"); assertEquals("key="value &"", attr.html()); assertEquals(attr.html(), attr.toString()); }
  • 50. 50 @Test public void html() { Attribute attr = new Attribute("key", "value &"); assertEquals("key="value &"", attr.html()); assertEquals(attr.html(), attr.toString()); } @Test public void html_add33() throws Exception { Attribute attr = new Attribute("key", "value &"); Assert.assertEquals("key="value &"", attr.html()); Assert.assertEquals("key="value &"", attr.toString()); Assert.assertEquals("key", attr.getKey()); Assert.assertEquals("value &", attr.getValue()); }
  • 51. 51
  • 52. 52
  • 53. 53 DSpot Automatic Test Improvement with DSpot: a Study with Ten Mature Open-Source Projects. B. Danglot, O. Luis Vera-Pérez, B. Baudry, M. Monperrus. Submitted to EMSE.
  • 54. Test amplification •Descartes: spots weak tests •Dspot: suggests improvements of existing tests •Available as Maven plugins •Method • Developer machine • In the CI •Future work • Integration in PR-based development • Develop work on advanced Maven dependency management 54
  • 56. More information • An Approach and Benchmark to Detect Behavioral Changes of Commits in Continuous Integration • https://arxiv.org/pdf/1902.08482 • Automatic Test Improvement with DSpot: a Study with Ten Mature Open-Source Projects • https://arxiv.org/pdf/1811.08330 • A Comprehensive Study of Pseudo-tested Methods • https://arxiv.org/pdf/1807.05030 • http://stamp-project.eu/ • https://github.com/KTH/devops-course/ • baudry@kth.se 56
  • 57. •4 res. institutions •5 companies •1 open source consortium •516 p.m •To increase test automation in DevOps