Kyle Mundt February 3, 2010.  Richard Lipton, 1971  A way of testing your tests  Alter your code in various ways  Check to see if tests fail on altered.

Slides:



Advertisements
Similar presentations
David Pryor. Mutation-Based Testing Same basic goal as Code Coverage Evaluate the tests Determine how much code exercised Mutation testing goes beyond.
Advertisements

Verification and Validation
Detecting Bugs Using Assertions Ben Scribner. Defining the Problem  Bugs exist  Unexpected errors happen Hardware failures Loss of data Data may exist.
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.
Practical Testing Techniques. Verification and Validation Validation –does the software do what was wanted? “Are we building the right system?” –This.
Test-Driven Development and Refactoring CPSC 315 – Programming Studio.
Programming Types of Testing.
An Analysis and Survey of the Development of Mutation Testing by Yue Jia and Mark Harmon A Quick Summary For SWE6673.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Software Quality Assurance
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
Test-Driven Development “Test first, develop later!” –OCUnit.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Language Evaluation Criteria
CSE 486/586 CSE 486/586 Distributed Systems PA Best Practices Steve Ko Computer Sciences and Engineering University at Buffalo.
Introduction to Software Testing Chapter 5.2 Program-based Grammars Paul Ammann & Jeff Offutt
Software Testing and Validation SWE 434
TESTING.
June 14, 2001Exception Handling in Java1 Richard S. Huntrods June 14, 2001 University of Calgary.
© 2012 IBM Corporation Rational Insight | Back to Basis Series Chao Zhang Unit Testing.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
© SERG Dependable Software Systems (Mutation) Dependable Software Systems Topics in Mutation Testing and Program Perturbation Material drawn from [Offutt.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Software testing techniques Software testing techniques Mutation testing Presentation on the seminar Kaunas University of Technology.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
Chapter 22 Developer testing Peter J. Lane. Testing can be difficult for developers to follow  Testing’s goal runs counter to the goals of the other.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
TEST-1 6. Testing & Refactoring. TEST-2 How we create classes? We think about what a class must do We focus on its implementation We write fields We write.
1 Introduction to Software Testing. Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Chapter 1 2.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
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.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Software Testing Part II March, Fault-based Testing Methodology (white-box) 2 Mutation Testing.
Introduction to Software Testing Chapter 9.2 Program-based Grammars Paul Ammann & Jeff Offutt
Objects First With Java A Practical Introduction Using BlueJ Well-behaved objects 2.1.
Software Quality Assurance and Testing Fazal Rehman Shamil.
Dynamic Testing.
Mutation Testing Breaking the application to test it.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 23, 1999.
MUTACINIS TESTAVIMAS Benediktas Knispelis, IFM-2/2 Mutation testing.
Mutation Testing Laraib Zahid & Mariam Arshad. What is Mutation Testing?  Fault-based Testing: directed towards “typical” faults that could occur in.
Software Testing and Quality Assurance Syntax-Based Testing (2) 1.
Eighth Lecture Exception Handling in Java
Software Testing.
14 Compilers, Interpreters and Debuggers
Introduction to Visual Basic 2008 Programming
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Mutation Testing Moonzoo Kim School of Computing KAIST
Mutation testing Julius Purvinis IFM-0/2.
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Introduction to Software Testing Chapter 5.2 Program-based Grammars
Baisc Of Software Testing
Welcome to Corporate Training -1
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Software Testing Syntax-based Testing.
Mutation Testing The Mutants are Coming! Copyright © 2017 – Curt Hill.
Tonga Institute of Higher Education IT 141: Information Systems
Mutation Testing Moonzoo Kim School of Computing KAIST
An Introduction to Debugging
Tonga Institute of Higher Education IT 141: Information Systems
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:

Kyle Mundt February 3, 2010

 Richard Lipton, 1971  A way of testing your tests  Alter your code in various ways  Check to see if tests fail on altered code  Becoming popular again due to increased computing power  Strongest use seems to be with Fortran and C (procedural languages)

 Mutant: code resulting from applying a mutation operator  Mutation (or Fault) Operator: rule used to create a mutant  Killing a Mutant: when tests fail on a mutant  Mutation-Adequate: tests kill all mutants  Equivalent mutant: produces same output as original (can’t be killed)  Mutation score: killed / (total – equivalent)

Original if (a == 10) b = 3; else b = 5; Mutant if (a != 10) b = 3; else b = 5;

 Apply mutation operators to code (only one change in each mutant)  Run mutants through test cases  Check mutants that do not fail ◦ Equivalent mutants  Change test cases to catch mutant  Repeat

 Don’t begin too early  Code should already be written  Tests should be reasonably thorough  Begin with good set of test cases and code that passes tests  Iterative process ◦ Create mutants, run tests, fix, repeat

 Traditional Mutation Operators ◦ Statement deletion ◦ Invert logical operators ◦ Replace arithmetic operators ◦ Replace variable with another in same scope  Class-Level Mutation Operators ◦ Object oriented ◦ Change containers ◦ Concurrency

 If test results are the same ◦ There is “dead code” ◦ Mutant is equivalent to original ◦ Test cases not complete  Code coverage not good enough  Functional testing not enough  Need way to analyze test effectiveness  Useful for hardware verification  Based on coupling effect: “ test data set that detects all simple faults in a program is so sensitive that it also detects more complex faults”  Ties into automatic test generation

 Hitting every line doesn’t guarantee good tests  Doesn’t ensure defects detected if they occur  Not good measure of verification effectiveness

 Testing functionality of program  Deals with how program should work  Mostly ignores how it shouldn’t  Functional tests are subjective  Also bad measure of verification quality

 Looking at, improving tests  Convinces us tests will detect defects if they occur  Similar to techniques done manually on hardware  Need way to automate it to be practical

 Verify testbed  Gives data to be used in improving chip testing  Hardware defects can cause unexpected behavior  Must ensure this behavior is caught  Attempt to show defects found by tests

 Adequate automation  Huge (maybe infinite) possible number of mutants  Fault classification and prioritization  Which operators to use  How to apply to OOP, concurrency, etc.

 Mothra – 22 operators  6 operators account for 40-60% of mutants  Redundant mutants (can be killed by same test)  Research shows 5 operators gives good data ◦ Gives 99% total mutant score and reduces number of mutants by 77%

 ABS – make value of each arithmetic expression be 0, positive, and negative  AOR – replace arithmetic operator with valid operators  LCR – replace each logical operator  ROR – replace relational operators  UOI – insert unary operators in front of expressions  Note this is used on Fortran, a procedural language

 Running whole program takes time  Don’t really care about what happens after mutant line hit  So, don’t execute whole mutant  Compare states of original and mutant after mutated line executed  Regular mutation requires three things ◦ Mutant be reached ◦ Mutant creates incorrect state in program ◦ Program state reflected as difference in test output  Weak Mutation only requires the first two  Related to automatic test generation

 Put all mutants into “metaprogram”  One large program to compile and link  Mothra turns program into intermediate form  Modifies intermediate form to create mutants  Interprets intermediate forms (interpreting is slow)  Schema-based is much faster than interpretive systems

 Can reduce number of test cases executed ◦ Once a test case is killed, remove it from further testing ◦ No reason to kill it twice  Random selection of mutants appropriate in some cases

 Easy to come up with operators for simple types  User types much harder  Operators have been developed for things like ◦ Inheritance ◦ Polymorphism ◦ Method visibility  Harder to mutate based on meaning of object  Some research applied to Java OO mutation

 Methods proposed to alter at code level ◦ Allows changes to things like attributes  Mutants made this way may not compile  Could cause integration errors  Still doesn’t look at meanings  Can write operators specifically for classes  Probably not practical in almost all situations  How to actually change object state?

 Mutate commonly used Java libraries  Again operators picked to try and simulate common mistakes  One solution found was to mutate Containers, Iterators, and InputStream  Java reflection can also be used to examine object fields at runtime

 Collection Interface (most apply to List or Vector as well) ◦ Make collection empty ◦ Remove some element (first, last, random) ◦ Reorder elements ◦ Mutate element type  Iterators: ◦ Skip element  InputStream ◦ Skip bytes of data

 First described for C programs  Designed for integration testing, mutate interface between modules  Designed to scale to larger systems  Actions taken to control number of mutants ◦ Only look at integration errors ◦ Tests only connections between pairs of subsystems ◦ Mutates only module interfaces (eg. Function calls, return values)

 MuClipse ◦ Open source mutation testing plug-in for Eclipse  µJava (muJava)  Heckle (Ruby)  Insure++ (C++)  Nester (C#)

 C# programs for Visual Studios 2005  Only supports NUnit Framework  Highlights code ◦ Killed mutations in green ◦ Surviving mutations in red ◦ Code not covered by tests in blue  Allows use of XML-based grammar to define own transformation rules

 Different approach  Used to find bugs in source code  Creates functionally equivalent mutants ◦ Lines changed without changing expected results  Tests should all still pass  If a test fails, something wrong with code  Insure++ reports faults and lines responsible

 More complicated programs equals greater need for quality tests  Need way to ensure/measure test effectiveness  Mutation-Based testing can fill this role  Still needs further research  Not a lot of implementations or examples of use on large scale  Getting attention in hardware verification  More work needs to be done to apply to OO

 [1] Offutt, J. A. & Untch, R. H. (October 2000). Mutation 2000: Uniting the Orthogonal. Retrieved January 18, 2011 from  [2] Bakewell, G. (2010). Mutation-Based Testing Technologies Close the “Quality Gap” in Functional Verification for Complex Chip Designs. Retrieved January 18, 2011, from Quality-Gap-in-Functional-Verification-for-Complex-Chip-Designs/4.aspx  [3] Offut, J. A. (June 1995). A Practical System for Mutation Testing: Help for the Common Programmer. Retrieved January 18, 2011 from  [4] Usaola, M. & Mateo, P. (2010). Mutation Testing Cost Reduction Techniques: A Survey. IEEE Software, 27(3), Retrieved January 23, 2011, from ABI/INFORM Global. (Document ID: ).  [5] Kolawa, Adam (1999). Mutation Testing: A New Approach to Automatic Error-Detection. Retrieved January 18, 2011, from  [6] Alexander, R. T.; Bieman, J. M.; Ghosh, S.; & Ji, B (2002). Mutation of Java Objects. Retrieved January 18, 2011 from  [7] Nester - Free Software that Helps to do Effective Unit Testing in C#.