MUTATION TESTING. Mutation testing is a technique that focuses on measuring the adequacy (quality) of test data (or test cases). Modify a program by introducing.

Slides:



Advertisements
Similar presentations
1 Software Unit Test Coverage And Test Adequacy Hong Zhu, Patrick A. V. Hall, John H.R. May Presented By: Arpita Gandhi.
Advertisements

Sufficient Mutant Operators Offutt, Rothermel, Lee, Untch, and Zapf TOSEM, April 1996 Slide text copyright Robert W. Hasker, 2006 Material (and figures)
Marking Schema question1: 40 marks question2: 40 marks question3: 20 marks total: 100 marks.
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
Order Statistics Sorted
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
An Analysis and Survey of the Development of Mutation Testing by Yue Jia and Mark Harmon A Quick Summary For SWE6673.
Software Testing and QA Theory and Practice (Chapter 3: Unit Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice Chapter.
MPI Program Structure Self Test with solution. Self Test 1.How would you modify "Hello World" so that only even-numbered processors print the greeting.
Unit Testing CSSE 376, Software Quality Assurance Rose-Hulman Institute of Technology March 27, 2007.
1 Software Testing and Quality Assurance Lecture 9 - Software Testing Techniques.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts and Debugging.
A CONTROL INSTRUMENTS COMPANY The Effectiveness of T-way Test Data Generation or Data Driven Testing Michael Ellims.
(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 1 Fault-Based Testing.
Introduction to Computer Programming Decisions If/Else Booleans.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts, Testing and Debugging.
CMSC 104, Version 8/061L22Arrays1.ppt Arrays, Part 1 of 2 Topics Definition of a Data Structure Definition of an Array Array Declaration, Initialization,
Command line arguments. – main can take two arguments conventionally called argc and argv. – Information regarding command line arguments are passed to.
1 Joe Meehean. 2 Testing is the process of executing a program with the intent of finding errors. -Glenford Myers.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Introduction to Software Testing Chapter 5.2 Program-based Grammars Paul Ammann & Jeff Offutt
Software Testing and Validation SWE 434
Domain testing Tor Stålhane. Domain testing revisited We have earlier looked at domain testing as a simple strategy for selecting test cases. We will.
© SERG Dependable Software Systems (Mutation) Dependable Software Systems Topics in Mutation Testing and Program Perturbation Material drawn from [Offutt.
Order Statistics The ith order statistic in a set of n elements is the ith smallest element The minimum is thus the 1st order statistic The maximum is.
What is Mutation Testing ? The premise in mutation testing is that small changes are made in a module and then the original and mutant modules are compared.
Algorithms and Algorithm Analysis The “fun” stuff.
CEN 4072 Software Testing Chapter 1: How Failures Come To Be.
Software testing techniques Software testing techniques Mutation testing Presentation on the seminar Kaunas University of Technology.
Ins & Outs of Unit Testing All About Unit Testing.
Testing Testing Techniques to Design Tests. Testing:Example Problem: Find a mode and its frequency given an ordered list (array) of with one or more integer.
Test Drivers and Stubs More Unit Testing Test Drivers and Stubs CEN 5076 Class 11 – 11/14.
Test Coverage CS-300 Fall 2005 Supreeth Venkataraman.
Software Reliability in Nuclear Systems Arsen Papisyan Anthony Gwyn.
White-box Testing.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
CMSC 104, Lecture 171 More Loops Topics l Counter-Controlled (Definite) Repetition l Event-Controlled (Indefinite) Repetition l for Loops l do-while Loops.
Mutation Testing G. Rothermel. Fault-Based Testing White-box and black-box testing techniques use coverage of code or requirements as a “proxy” for designing.
Bug Localization with Association Rule Mining Wujie Zheng
CMSC 104, Version 9/011 More Loops Topics Counter-Controlled (Definite) Repetition Event-Controlled (Indefinite) Repetition for Loops do-while Loops Choosing.
Software Testing Part II March, Fault-based Testing Methodology (white-box) 2 Mutation Testing.
Software Testing Syntax-based Testing. Syntax Coverage Four Structures for Modeling Software Graphs Logic Input Space Syntax Use cases Specs Design Source.
Introduction to Software Testing Chapter 9.2 Program-based Grammars Paul Ammann & Jeff Offutt
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing III No reading Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
CSC 213 – Large Scale Programming. Today’s Goal  Understand why testing code is important  Result of poor or no testing & embarrassment caused  Learn.
Foundations of Software Testing Slides based on: Draft V4.0. November 19, 2006 Test Adequacy Measurement and Enhancement Using Mutation Last update: January15,
Mutation Testing Breaking the application to test it.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 23, 1999.
CS241 Systems Programming Discussion Section Week 2 Original slides by: Stephen Kloder.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
Dr. Rob Hasker Dr. Brad Dennis. Coverage  Exercise: Each participant: write down 4 instructions Input to procedure: value given by someone, which person.
MUTACINIS TESTAVIMAS Benediktas Knispelis, IFM-2/2 Mutation testing.
Chapter 15 Running Time Analysis. Topics Orders of Magnitude and Big-Oh Notation Running Time Analysis of Algorithms –Counting Statements –Evaluating.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
Mutation Testing Laraib Zahid & Mariam Arshad. What is Mutation Testing?  Fault-based Testing: directed towards “typical” faults that could occur in.
Dynamic Black-Box Testing Part 1 What is dynamic black-box testing? How to reduce the number of test cases using: Equivalence partitioning Boundary value.
Software Testing and Quality Assurance Syntax-Based Testing (2) 1.
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 3 Unit Testing
White-Box Testing Techniques IV
White-Box Testing Techniques IV
Analyzing the Validity of Selective Mutation with Dominator Mutants
Mutation testing Julius Purvinis IFM-0/2.
Mutation Testing Tutorial Answers
Software Testing Syntax-based Testing.
Mutation Testing The Mutants are Coming! Copyright © 2017 – Curt Hill.
Regression Testing.
HNDIT11034 More Operators.
Mutation Testing Faults are introduced into the program by creating many versions of the program called mutants. Each mutant contains a single fault. Test.
Presentation transcript:

MUTATION TESTING

Mutation testing is a technique that focuses on measuring the adequacy (quality) of test data (or test cases). Modify a program by introducing a single small change to the code A modified program is called mutant A mutant is said to be killed when the execution of test case cause it to fail. The mutant is considered to be dead A mutant is an equivalent to the given program if it always produce the same output as the original program A mutant is called killable or stubborn, if the existing set of test cases is insufficient to kill it A mutation score for a set of test cases is the percentage of non- equivalent mutants killed by the test suite The test suite is said to be mutation-adequate if its mutation score is 100%

the following program P that finds rank corresponding to the first time the maximum value appears in the array 1. main(argc,argv) 2. int argc, r, i; 3. char *argv[]; 4. { r = 1; 5. for i = 2 to 3 do 6. if (atoi(argv[i]) > atoi(argv[r])) r = i; 7. printf("Value of the rank is %d \n", r); 8. exit(0); }

TestCases Test case 1: Input: Output: Value of the rank is 3 Test case 2: Input: Output: Values of the rank is 2 Test case 3: Input: Output: Value of the rank is 1

1. Mutant 1: Change line 5 to for i = 1 to 3 do 2. Mutant 2: Change line 6 to if (i > atoi(argv[r])) r = i; 3. Mutant 3: Change line 6 to if (atoi(argv[i]) >= atoi(argv[r])) r = i; 4. Mutant 4: Change line 6 to if (atoi(argv[r]) > atoi(argv[r])) r = i; let us mutate the program P. We can start with the following changes:

Mutants 1 and 3: The programs will completely pass the test suite. In other words, mutants 1 and 3 are not killed. Mutant 2: The program will fail test case 2. Mutant 4: The program will fail test case 1 and test case 2.

calculate the mutation score Mutation score = 100×D/(N −E), where ▫D: is the dead mutants, ▫N: the total number of mutants, ▫E: the number of equivalent mutants. Assuming that mutants 1 and 3 are nonequivalent. mutation score is 50%. It is low because we assumed that mutants 1 and 3 are nonequivalent to the original program we need to add new test cases to kill these two mutants

1 and 3 are equivalent mutants or those are killable??!! analyze mutant is an equivalent mutant. add a fourth test case as follows: Test case 4: Input: P : the output “Value of the rank is 1” mutant 3 : the output “Value of the rank is 2.” Thus, this test data kills mutant 3, which give us a mutation score of 100%.

Steps to build a robust test suite Step 1: Begin with a program P and a set of test cases T known to be correct. Step 2: Run each test case in T against the program P. ▫If it fails (o/p incorrect) P must be modified and restarted. Else, go to step 3 Step 3: Create a set of mutants {Pi }, each differing from P by a simple, syntactically correct modification of P.

Step 4: Execute each test case in T against each mutant Pi. If the o/p is differ  the mutant Pi is considered incorrect and is said to be killed by the test case If Pi produces exactly the same results: ▫P and Pi are equivalent ▫Pi is killable (new test cases must be created to kill it)

Step 5: Calculate the mutation score for the set of test cases T. Mutation score = 100×D/(N −E), Step 6: If the estimated mutation adequacy of T in step 5 is not sufficiently high, then design a new test case that distinguishes Pi from P, add the new test case to T, and go to step 2.