1 Automating the Generation of Mutation Tests Mike Papadakis and Nicos Malevris Department of Informatics Athens University of Economics and Business.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Advanced Piloting Cruise Plot.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Chapter 1 The Study of Body Function Image PowerPoint
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Algebraic Expressions
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
and 6.855J Cycle Canceling Algorithm. 2 A minimum cost flow problem , $4 20, $1 20, $2 25, $2 25, $5 20, $6 30, $
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 11: Structure and Union Types Problem Solving & Program Design.
Chapter 3: Top-Down Design with Functions Problem Solving & Program Design in C Sixth Edition By Jeri R. Hanly & Elliot B. Koffman.
Human Performance Improvement Process
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
Multiplying binomials You will have 20 seconds to answer each of the following multiplication problems. If you get hung up, go to the next problem when.
0 - 0.
ALGEBRAIC EXPRESSIONS
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
ALGEBRAIC EXPRESSIONS
Year 6 mental test 5 second questions
Year 6 mental test 10 second questions
ZMQS ZMQS
All You Ever Wanted to Know About Dynamic Taint Analysis & Forward Symbolic Execution (but might have been afraid to ask) Edward J. Schwartz, ThanassisAvgerinos,
Solve Multi-step Equations
1 Software Unit Test Coverage And Test Adequacy Hong Zhu, Patrick A. V. Hall, John H.R. May Presented By: Arpita Gandhi.
Data Structures: A Pseudocode Approach with C
ABC Technology Project
Columbus State Community College
Shadow Prices vs. Vickrey Prices in Multipath Routing Parthasarathy Ramanujam, Zongpeng Li and Lisa Higham University of Calgary Presented by Ajay Gopinathan.
4.6 Perform Operations with Complex Numbers
1 Undirected Breadth First Search F A BCG DE H 2 F A BCG DE H Queue: A get Undiscovered Fringe Finished Active 0 distance from A visit(A)
VOORBLAD.
1. 2 No lecture on Wed February 8th Thursday 9 th Feb 14: :00 Thursday 9 th Feb 14: :00.
Solving Equations How to Solve Them
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Squares and Square Root WALK. Solve each problem REVIEW:
1..
Do you have the Maths Factor?. Maths Can you beat this term’s Maths Challenge?
© 2012 National Heart Foundation of Australia. Slide 2.
The x- and y-Intercepts
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
1 Chapter 4 The while loop and boolean operators Samuel Marateck ©2010.
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Slippery Slope
U1A L1 Examples FACTORING REVIEW EXAMPLES.
H to shape fully developed personality to shape fully developed personality for successful application in life for successful.
Januar MDMDFSSMDMDFSSS
Week 1.
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
©2004 Brooks/Cole FIGURES FOR CHAPTER 12 REGISTERS AND COUNTERS Click the mouse to move to the next page. Use the ESC key to exit this chapter. This chapter.
PSSA Preparation.
Immunobiology: The Immune System in Health & Disease Sixth Edition
CpSc 3220 Designing a Database
Presentation transcript:

1 Automating the Generation of Mutation Tests Mike Papadakis and Nicos Malevris Department of Informatics Athens University of Economics and Business

Test Data Generation Approaches Symbolic execution Select set of paths Produce a system of algebraic constraints Solve and generate test cases Challenges (Symbolic execution) Infeasible paths Complex-unhandled expressions Availability of source code 2

Test Data Generation Approaches Search based approaches Definition of program input Dynamic program execution Fitness function o (efficiency and effectiveness) Challenges Handling of dynamic program inputs Require a high number of executions Handling of specific cases (e.g. flag problem) Effective fitness function 3

Test Data Generation Approaches Dynamic Symbolic Execution Simultaneously perform actual and symbolic execution o Simplify the process based on concrete program execution Produce a system of algebraic constraints Solve and generate test cases Challenges Infeasible paths Scalability issues 4

5 In order to kill a mutant, tests must Stage 1: Reach the mutant Stage 2: infect the program state Stage 3: propagate the infected state Killing Mutants

6 Reach the mutant (Reachability condition) Infect program state (necessity condition) Program execution must cause a discrepancy in the program state E.g. Orig: a > b, Mut = a b a > b a b o a == b where Orig = false, Mut = true Propagate (sufficiency condition) Heuristic approaches o explore path space, measure of mutants impact Joint satisfaction (Reach && Infect && Propagate) Killing Mutants

7 Killing Mutants (path selection) Symbolic Execution Reach o Use paths from program input to mutant Infect o Use necessity constraints to infect program state o Original Statement Mutated Statement Propagate o Explore the path space (from mutant to program output) Path selection Strategy

8 Enhanced Test Model (Enhanced Control Flow Graph) Represent mutants in the model Guide the selection of paths and the produced constraints based on the Shortest path strategy Killing Mutants (path selection)

9 Shortest Path Strategy, the k-value An efficient path selection strategy. (eliminates the effects of infeasible paths) Select shortest paths from program input (S) to the mutant statement (m) Heuristic approach to weak mutation Strong mutation can be tackled incrementally

10 Killing Mutants Dynamic approaches Dynamic approaches Gain the required information from actual program execution Require high number of program execution Mutation Testing Need to unify the runtime information of the original and mutant programs Need to include mutant neccesity and sufficiency conditions into program structure Need for efficiency (high cost)

11 Mutant Schemata Mutant schemata-Parameterized mutants Technique for efficiently producing mutants Embeds all mutants into one meta-mutant program Use of global parameter to specify the mutants Example original meta-mutant a > b + c RelationalGT(a, ArithmeticPlus(M(b), M(c))) M(x) mutates variable x, e.g. abs(x) Arithmetic(x, y) mutates arithmetic operator, e.g. x - y Relational(x, y) mutates relational operator, e.g. x y

12 Mutant Schemata (approach I) Weak mutation Include the mutant evaluation inside schematic functions o Original expression Mutant expression o Original statement Mutant statement After evaluation continue with the original execution (schematic function returns the original expression) Able to execute all mutants with one execution run Embeds all mutants killable condition into program structure (mutant evaluation branches)

Mutant is killed Mutant is Alive Mutant Schemata Proposed approach (Mutants to branches) Mutants M[1]…M[n] on node N. Mutant Evaluation Branches 13

14 Mutant Schemata (approach II) Strong mutation In Same lines as Weak o Include the mutant evaluation inside schematic functions After evaluation continue with the mutant execution (schematic function returns the mutant expression) Incremental approach, from weak to strong Requires multiple execution runs Record original and mutants execution paths Evaluate strongly killed mutants

15 Killing Mutants (DSE) Use the shortest path heuristic Negate the condition that will lead closer to mutant node (reach the mutant) Weakly kill the mutant Fulfill the mutant necessity condition Make the mutant evaluation Branch true Negate the produced conditions after the mutant Start from the mutant program Explores the mutant program path space

16 Target Mutant DSE-Example Scenario

17 Target Mutant DSE-Example Scenario

18 Target Mutant DSE-Example Scenario

19 Target Mutant DSE-Example Scenario

20 Target Mutant Mutant is alive Infect Mutant DSE-Example Scenario

21 Target Mutant Mutant is alive Propagate DSE-Example Scenario

22 Target Mutant Mutant is alive DSE-Example Scenario

23 Target Mutant Mutant Killed DSE-Example Scenario

24 DSE-Necessity condition Example: a + b > k a + abs(b) > k RelationalGT(ArithmeticPlus(a, Abs(b)), k) Abs(x) if (x <0 ) //mutant necessity condition a + b > k a + abs(b) > k //Statement level condition Test: a=15, b=2, k=0 Conditions: b0 && a+b>k && … Negates: b0 b < 0 Produces: a=15, b=-10, k=0

25 DSE-Necessity condition Example: a + b > k a + abs(b) > k RelationalGT(ArithmeticPlus(a, Abs(b)), k) Abs(x) if (x <0 ) //mutant necessity condition a + b > k a + abs(b) > k //Statement level condition Test: a=15, b=-10, k=0 Conditions: b k && a+abs(b)>k && … Negates: a+abs(b)>k b k && a+abs(b)k Infeasible Negates: a+b>k b<0 && a+bk Produces: a=-15, b=-10, k=0

26 DSE-Necessity condition Example: a + b > k a + abs(b) > k RelationalGT(ArithmeticPlus(a, Abs(b)), k) Abs(x) if (x <0 ) //mutant necessity condition a + b > k a + abs(b) > k //Statement level condition Test: a=-15, b=-10, k=0 Conditions: b<0 && a+bk && a+abs(b)k && … Negates: a+abs(b)>k b k Produces: a=5, b=-10, k=0 Mutant infected: Orig: 5-10>0 (false), Mut: 5+10>0 (true)

27 Killing Mutants (Search Based) Weak-Strong mutation Measure the closeness of reaching a mutant Measure branch distance of mutant branches o Closeness of weakly killing the targeted mutant (mutant necessity condition) Use simplified necessity fitness for improved performance Sufficiency condition can be approximated by exploring the path space or based on mutants impact

28 Fitness function Approach level Closeness of executing a targeted mutant Calculated by the number of control dependent nodes missed Branch Distance Closeness of flipping a specific branch Mutation Distance Closeness of weakly killing the targeted mutant

29 Mutant Fitness (example) OperatorOriginal expressionMutant Fitness Relationala > b a >= b: abs(a-b) a < b: k a <= b: 0 a != b: abs(a-b+k) a == b: abs(a-b) true: abs(a-b) false: abs(a-b+k) Arithmetica + b a - b:k a * b:k a / b:k a % b:k a:k b:k Absolutea abs(a):abs(a+k)-abs (a):abs(a) 0:abs(a) Logical a && b a||b:min[Tfit(a)+Ffit(b), Ffit(a)+Tfit(b)] a:Tfit(a)+Ffit(b) b:Ffit(a)+Tfit(b) true:min [Ffit(a), Ffit(b)] false:Tfit(a)+Tfit(b) a || b a&&b:min[Tfit(a)+Ffit( b), Ffit(a)+Tfit(b)] a:Ffit(a)+Tfit(b) b:Tfit(a)+Ffit(b) true:Ffit(a)+Ffit(b) false:min[Tfit(a), Tfit(b)]

30 Path explosion problem Original program 8 program paths Mutant program 8 program paths per mutant Schematic program Mutant evaluation decisions 8 * 2 number of mutants paths Introduction of fake paths Same of them may be useful for higher order mutation Mutants

31 Handling of path explosion Path selection strategy, (symbolic execution) Use weights on the Enhanced Control Flow Graph Shortest paths include only the original paths Dynamic Symbolic Execution Use the mutant parameters as local values Dynamic production of constraints eliminates the fake paths. Paths are produced dynamically Search based approaches Approach level contains only the control depended nodes o Ignores the path space

32 Case Studies Dynamic Symbolic Execution (Strong mutation) Program units: Tritype, Remainder Siemens Programs: Schedule, Tcas, Replace ABS, AOR and ROR operators Search based (Weak mutation results) Hill climbing approach (AVM) Maximum 10 attempts per mutant Program units: Tritype, Triangle, Remainder, Calendar ABS, AOR, ROR and LCR operators

DSE Study-Results

Program ½ IterationsAll Iterations Produced Tests Killed Mutants Solver Calls No. Mut. Executions Killed Mutants Solver Calls No. Mut. Executions Tritype Remainder Replace Tcas Schedule DSE Study-Results Strong mutation results Replace 86.5%, Tcas 100%, Schedule 91% (compared with the accompanied test suite), Remainder 97.5 and Tritype 96.8% (all killable mutants)

39 Search Based Study-Results

40 Search Based Study-Results

41 Search Based Study-Results

42 Search Based Study-Results

43 Search Based Study-Results Test Objects No. of Killed MutantsMutation Score Time (Sec) RandomMetallaxisRandomMetallaxis Tritype %96.8%42 Triangle %100%70 Remainder %100%402 Cal %99.2%44 Weak mutation results

Conclusion Mutation based test case generation Lack of attempts First steps using dynamic, state of the art techniques Dynamic approaches can be adopted to perform mutation Search based approaches o Mutation distance leads to improved effectiveness Dynamic Symbolic Execution o Quite effective 44

Conclusion Test data generation approaches and tools can be effectively extended to mutation Practical Technique (schemata) Future directions Efficient handling of infeasible paths Handling of the flag problem Efficient handling of equivalent mutants Hybrid approaches 45

Thank you for your attention… Questions ? Contact Mike Papadakis Nicos Malevris 46

47 References Mike Papadakis and Nicos Malevris. "Automatic Mutation Test Case Generation Via Dynamic Symbolic Execution", in 21st International Symposium on Software Reliability Engineering (ISSRE'10), San Jose, California, USA, November Mike Papadakis and Nicos Malevris. Metallaxis an Automated Framework for Weak Mutation", Technical Report, Mike Papadakis, Nicos Malevris and Maria Kallia. "Towards Automating the Generation of Mutation Tests", in Proceedings of the 5th International Workshop on Automation of Software Test (AST'10), Cape Town, South Africa, May 2010, pp Mike Papadakis and Nicos Malevris. An Effective Path Selection Strategy for Mutation Testing", in Proceedings of the 16th Asia-Pacific Software Engineering Conference (APSEC'09), Penang, Malaysia, December 2009, pp