Caroline Landry, Research engineer at Inria, presented the STAMP project at OW2con'19, June 12-13, 2019 in Paris. This talk presents two automatic techniques that can be used in the CI to reveal weaknesses and suggest possible improvements of your test cases. The first one is based on mutation testing, while the second one is based on test amplification.
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Improve your tests in the CI with STAMP, OW2con'19, June 12-13, 2019, Paris
1. 1
Improve your tests in the CI with STAMP
Benoit Baudry
Project Coordinator and Scientific Leader
KTH, Sweden
Caroline Landry
Project Technical Manager
INRIA, France
19-Apr-2019
2. This work was partially supported by the EU Project
STAMP ICT-16-10 No.731529
•4 research institutions
•5 companies
•1 open source
consortium
•Automated Testing in
DevOps
7. STAMP’s concept: amplification
Test developers capture essential behaviors and
expectations
But tests are uncomplete
Test amplification: Increase the effect of test assets
Automatic analysis and transformations
Automatic assessment and selection
In the continuous integration pipeline
7https://dictionary.cambridge.org/dictionary/english/amplify
13. Descartes I mutate therefore I am
• A mutation engine for PIT
• Implement extreme mutation
• Compute code coverage & mutation score
• Identify weaknesses in your tests
• Find pseudo-tested methods
24. 24
@Test
public void html() {
Food kouignAmann = new Food("KouignAmann");
PhD benjamin = new PhD("Benjamin");
benjamin.eat(kouignAmann);
assertFalse(benjamin.isHungry());
}
Example
Original
test case
25. 25
@Test
public void html() {
Food kouignAmann = new Food("KouignAmann");
PhD benjamin = new PhD("Benjamin");
benjamin.eat(kouignAmann);
assertFalse(benjamin.isHungry());
}
Example
Original
test case
Remove a method call
26. @Test
public void html() {
Food kouignAmann = new Food("KouignAmann");
PhD benjamin = new PhD("Benjamin");
assertTrue(benjamin.isHungry());
assertFalse(benjamin.isHappy());
} 26
Example
Original
test case
Amplified
test case
@Test
public void html() {
Food kouignAmann = new Food("KouignAmann");
PhD benjamin = new PhD("Benjamin");
benjamin.eat(kouignAmann);
assertFalse(benjamin.isHungry());
}
Remove a method call
Instrument the test and
run it again
27. 27
@Test
public void html() {
Attribute attr = new Attribute("key", "value &");
assertEquals("key="value &"", attr.html());
assertEquals(attr.html(), attr.toString());
}
Original
test case
DSpot
28. 28
@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());
}
@Test
public void html() {
Attribute attr = new Attribute("key", "value &");
assertEquals("key="value &"", attr.html());
assertEquals(attr.html(), attr.toString());
}
Original
test case
Amplified
test case
New assertions
DSpot
29. 29
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.