Sufficient Mutant Operators Offutt, Rothermel, Lee, Untch, and Zapf TOSEM, April 1996 Slide text copyright Robert W. Hasker, 2006 Material (and figures)

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 1.
Advertisements

1 Software Unit Test Coverage And Test Adequacy Hong Zhu, Patrick A. V. Hall, John H.R. May Presented By: Arpita Gandhi.
David Pryor. Mutation-Based Testing Same basic goal as Code Coverage Evaluate the tests Determine how much code exercised Mutation testing goes beyond.
Chapter 7 Introduction to Procedures. So far, all programs written in such way that all subtasks are integrated in one single large program. There is.
Chapter 3 Program Design And Branching Structures.
Random Testing Tor Stålhane Jonas G. Brustad. What is random testing The principle of random testing is simple and can be described as follows: 1.For.
Slides 2c: Using Spreadsheets for Modeling - Excel Concepts (Updated 1/19/2005) There are several reasons for the popularity of spreadsheets: –Data are.
White-Box Testing Techniques IV
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.
Lecture 7 Advanced Topics in Testing. Mutation Testing Mutation testing concerns evaluating test suites for their inherent quality, i.e. ability to reveal.
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.
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.
Michael Ernst, page 1 Improving Test Suites via Operational Abstraction Michael Ernst MIT Lab for Computer Science Joint.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
State coverage: an empirical analysis based on a user study Dries Vanoverberghe, Emma Eyckmans, and Frank Piessens.
Fundamentals of Python: From First Programs Through Data Structures
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
CSCI 5801: Software Engineering
Copyright 2015, Robert W. Hasker. Reviewing CI Setup  So what do the steps do?  Key concept: search path  Windows: for each command, run through PATH.
Fundamentals of Python: First Programs
Introduction to Software Testing Chapter 5.2 Program-based Grammars Paul Ammann & Jeff Offutt
Software Testing and Validation SWE 434
Kyle Mundt February 3,  Richard Lipton, 1971  A way of testing your tests  Alter your code in various ways  Check to see if tests fail on altered.
© SERG Dependable Software Systems (Mutation) Dependable Software Systems Topics in Mutation Testing and Program Perturbation Material drawn from [Offutt.
Introduction to Software Testing
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.
Software testing techniques Software testing techniques Mutation testing Presentation on the seminar Kaunas University of Technology.
Grey Box testing Tor Stålhane. What is Grey Box testing Grey Box testing is testing done with limited knowledge of the internal of the system. Grey Box.
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 Coverage CS-300 Fall 2005 Supreeth Venkataraman.
Syntax-Based Testing Mingzhe Du Hongying Du Dharani Chintapatla.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 20 Slide 1 Critical systems development 3.
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.
Shell Scripting – Putting it All Together. Agenda Escaping Characters Wildcards Redirecting Output Chaining and Conditional Chaining Unnamed and Named.
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
Integration testing Integrate two or more module.i.e. communicate between the modules. Follow a white box testing (Testing the code)
Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved.
Establishing Theoretical Minimal Sets of Mutants ICST 2014 Paul Ammann Joint work with Marcio Eduardo Delamaro Jeff Offutt April 1, 2014.
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing III No reading Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
1 Using a Fault Hierarchy to Improve the Efficiency of DNF Logic Mutation Testing Gary Kaminski and Paul Ammann ICST 2009.
Mutation Testing Breaking the application to test it.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 23, 1999.
Week 6 MondayTuesdayWednesdayThursdayFriday Testing III Reading due Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
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.
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.
Informatics 43 – May 3, Restatement of goals Want to verify software’s correctness  Need to test  Need to decide on test cases  No set of test.
Software Testing and Quality Assurance Syntax-Based Testing (2) 1.
John D. McGregor Session 9 Testing Vocabulary
The Joy of Breaking Code Testing Logic and Case Selection
White-Box Testing Techniques IV
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Mutation Testing Moonzoo Kim School of Computing KAIST
Analyzing the Validity of Selective Mutation with Dominator Mutants
Chapter 2 Assignment and Interactive Input
Mutation testing Julius Purvinis IFM-0/2.
Syntax-based Testing CS 4501 / 6501 Software Testing
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Introduction to Software Testing Chapter 5.2 Program-based Grammars
Software Testing Syntax-based Testing.
Mutation Testing The Mutants are Coming! Copyright © 2017 – Curt Hill.
Regression Testing.
Mutation Testing Moonzoo Kim School of Computing KAIST
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:

Sufficient Mutant Operators Offutt, Rothermel, Lee, Untch, and Zapf TOSEM, April 1996 Slide text copyright Robert W. Hasker, 2006 Material (and figures) from Determination of Sufficient Mutant Operators, ACM Transactions on Software Engineering and Methodology, Vol. 5, No. 2 (April 1996)

Testing Programs by Random Changes Mutation testing: randomly change code, run against test suite Mutation testing: randomly change code, run against test suite For example, change For example, change int min(int a, int b) { int result = a; if ( b < a ) result = b; return result;} into into int min(int a, int b) { int result = b; if ( b < a ) result = b; return result; } Now: min(6, 1) gives 1, but min(1, 6) gives 6 Now: min(6, 1) gives 1, but min(1, 6) gives 6

What does this tell us? If new program produces same output on all test data, then either If new program produces same output on all test data, then either –Test data not sufficient to capture all error –Program contains dead code –New program equivalent to the old Thus: tool tests the test suite Thus: tool tests the test suite –Similar to structural coverage Problem: potentially an infinite number of mutants! Problem: potentially an infinite number of mutants!

Other Versions of min Changing : Changing : int min(int a, int b) { int result = a; int result = a; if ( b > a ) result = b; if ( b > a ) result = b; return result; return result;} Replacing a by result (equivalent mutant): Replacing a by result (equivalent mutant): int min(int a, int b) { int result = a; int result = a; if ( b < result ) result = b; if ( b < result ) result = b; return result; return result;} –Note this mutant could be eliminated by definition-use analysis

So why is mutation testing helpful? Structural coverage is a very minimal criterion Structural coverage is a very minimal criterion Consider Consider int max(int xs[], int len) { int res = -1; int res = -1; for(int i = 0; i < len; ++i) for(int i = 0; i < len; ++i) if ( xs[i] > res ) res = xs[i]; if ( xs[i] > res ) res = xs[i]; return res; return res; } –with int nums[3] = {-9, 5, 0}; –Get coverage with max(nums, 3); –Fails: max(nums, 1);

Mutation Testing, Described Competent programmer hypothesis Competent programmer hypothesis –Assumption: if program to be tested isnt correct, it contains at most a few small errors Plan: generate code, generate tests, generate non-equivalent mutants, add to tests until all mutants killed Plan: generate code, generate tests, generate non-equivalent mutants, add to tests until all mutants killed What operators for generating mutants? What operators for generating mutants? Mothra: system developed in 90s which used 22 operators Mothra: system developed in 90s which used 22 operators –Are all of these operators necessary? –In general: do we need a huge number of operators to make this work?

Set of Mutant Operators (in Mothra) (for Fortran – C would be similar) AARarray reference for array reference replacement ABSabsolute value insertion ACRArray reference for constant replacement AORArithmetic operator replacement ASRArray reference for scalar variable replacement CARConstant for array reference replacement CNRComparable array name replacement CRPConstant replacement CSRConstant for scalar variable replacement DERDO statement end replacement

Mutant Operators, Continued DSADATA statement alterations GLRGOTO label replacement LCRLogical connector replacement RORRelational operator replacement RSRRETURN statement replacement SANStatement analysis - replace statements by traps, return, goto SARScalar variable for array reference replacement SCRScalar for constant replacement SDLStatement deletion SRCSource constant replacement SVRScalar variable replacement UOIUnary operator insertion

Musing on Mutant Operators 22 operators too many mutants! 22 operators too many mutants! But note some operators produce more mutants than others: But note some operators produce more mutants than others: ~18% by SVR, ~13% by ASR; ~60% by top five ~18% by SVR, ~13% by ASR; ~60% by top five Can we find a useful subset? Can we find a useful subset?

An experiment 10 Fortran programs (or subroutines): 10 Fortran programs (or subroutines): ProgramDescriptionStmtsMutants BankerDeadlock avoidance BubBubble sort over ints11338 CalDays between 2 dates EuclidGreatest common divisor11196 FindPartition array InsertInsertion sort over ints14460 MidMedian of three ints16183 QuadReal roots of quadratic eqn10359 TritypTriangle classification28951 WarshallTransitive closure of matrix11305

Experiment, contd. Use tool to generate test data sets Use tool to generate test data sets Augmented these with hand-generated data sets to kill remaining incorrect mutants Augmented these with hand-generated data sets to kill remaining incorrect mutants –Small number of hand-generated cases compared to total test cases –Also tried completely random data; results similar Generated 5 sets of test cases for each program Generated 5 sets of test cases for each program –Each set is then able to kill all non-equivalent mutants Then scored each set of test cases against all mutants Then scored each set of test cases against all mutants –The result: percentage of total mutants that are killed –Any mutant killed by same test set is redundant!

Results Tried different sets, found best results with five operators Tried different sets, found best results with five operators –ABS, AOR, LCR, ROR, UOI Each test set generated using these mutant operators resulted in killing 98.5% (and an average of 99.5%) of all mutants: Each test set generated using these mutant operators resulted in killing 98.5% (and an average of 99.5%) of all mutants: Conclusion: these operators sufficient Conclusion: these operators sufficient

Results, Continued Removing UOI, AOR, ABS would clearly weaken tests Removing UOI, AOR, ABS would clearly weaken tests Evidence for removing LCR is weak; few such connectives in sample programs Evidence for removing LCR is weak; few such connectives in sample programs ROR provides branch coverage and so hard to justify removing ROR provides branch coverage and so hard to justify removing

Minimum Set of Operators (for Fortran) ABS: insert calls to an absolute value function ABS: insert calls to an absolute value function AOR: replace all arithmetic ops by every syntactically legal alternatives AOR: replace all arithmetic ops by every syntactically legal alternatives LCR: replaces AND, OR by all logical connectors LCR: replaces AND, OR by all logical connectors ROR: replace (modify) relational operators ROR: replace (modify) relational operators UOI: insert unary operators UOI: insert unary operators

Conclusion Five operators, responsible for ~17% of all mutants, sufficient for 10 test programs Five operators, responsible for ~17% of all mutants, sufficient for 10 test programs In general: get O(Lines + References) mutants In general: get O(Lines + References) mutants Constant for O is large! Constant for O is large! Above 10 programs (200 lines): 231,972 mutants Above 10 programs (200 lines): 231,972 mutants Result: a testing method with minimal user input: Result: a testing method with minimal user input: 1. Write code 2. Write tests, possibly using a tool to generate cases 3. Evaluate tests using mutants; if some non-equivalent mutant not killed, extend test set Would probably focus on critical routines (unit testing) Would probably focus on critical routines (unit testing)