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.

Slides:



Advertisements
Similar presentations
Testing and Quality Assurance
Advertisements

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.
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.
An Analysis and Survey of the Development of Mutation Testing by Yue Jia and Mark Harmon A Quick Summary For SWE6673.
Unit Testing CSSE 376, Software Quality Assurance Rose-Hulman Institute of Technology March 27, 2007.
A Theory of Fault Based Testing Larry J. Morell Presented by: Joonghoon Lee.
1 Software Testing and Quality Assurance Lecture 9 - Software Testing Techniques.
(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 1 Fault-Based Testing.
Testing an individual module
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
System/Software Testing
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
Dr Andy Brooks1 FOR0383 Software Quality Assurance Lecture 1 Introduction Forkröfur/prerequisite: FOR0283 Programming II Website:
Objectives Understand the basic concepts and definitions relating to testing, like error, fault, failure, test case, test suite, test harness. Explore.
CPIS 357 Software Quality & Testing
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
© SERG Dependable Software Systems (Mutation) Dependable Software Systems Topics in Mutation Testing and Program Perturbation Material drawn from [Offutt.
Coverage – “Systematic” Testing Chapter 20. Dividing the input space for failure search Testing requires selecting inputs to try on the program, but how.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
Software testing techniques Software testing techniques Mutation testing Presentation on the seminar Kaunas University of Technology.
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
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.
Black-box Testing.
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Developing and Evaluating Theories of Behavior.
White-box Testing.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Testing Techniques Software Testing Module ( ) Dr. Samer Hanna.
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 Metric; defect removal efficiency, Cyclomate Complexity Defect Seeding Mutation Testing.
CPSC 873 John D. McGregor Session 9 Testing Vocabulary.
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
Software Quality Assurance and Testing Fazal Rehman Shamil.
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing III No reading Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
1. Black Box Testing  Black box testing is also called functional testing  Black box testing ignores the internal mechanism of a system or component.
Dynamic Testing.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
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.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
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.
CS223: Software Engineering Lecture 25: Software Testing.
Testing Integral part of the software development process.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
Software Testing and Quality Assurance Syntax-Based Testing (2) 1.
A Review of Software Testing - P. David Coward
Software Testing.
Software Testing.
John D. McGregor Session 9 Testing Vocabulary
Introduction to Software Testing Chapter 9.2 Program-based Grammars
GC211Data Structure Lecture2 Sara Alhajjam.
Mutation testing Julius Purvinis IFM-0/2.
John D. McGregor Session 9 Testing Vocabulary
John D. McGregor Session 9 Testing Vocabulary
Unit# 9: Computer Program Development
Program Design Introduction to Computer Programming By:
Software Testing (Lecture 11-a)
Lecture 09:Software Testing
Developing and Evaluating Theories of Behavior
Programming Languages 2nd edition Tucker and Noonan
Chapter 10 – Software Testing
Mutation Testing The Mutants are Coming! Copyright © 2017 – Curt Hill.
Chapter 10: Compilers and Language Translation
Programming Languages 2nd edition Tucker and Noonan
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:

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. Similar idea to error seeding: introduce defects and verify that test cases are comprehensive enough to 'catch' the defects (called mutants). This method is more systematic--all single modifications to the code are generated-- each single modification yields a new mutant. The idea is that test suite is adequate when it suffices to distinguish between the original and any non-equivalent mutant. To be cost-effective, selectively insert only realistic mutations (defects) and see whether your test suite catches the implanted defect.

Basic Assumption of Mutation Testing Competent programmer hypothesis The program to be tested has been written by a competent programmer. SQE 2. The Coupling Effect The test data that distinguishes all programs differing from a correct one by only simple errors are so sensitive that they are also implicitly distinguished more complex errors. There is no hope of ‘proving’ the coupling effect; it is an empirical hypothesis.

Basic Steps of Mutation Testing Mutation Testing Executing the Program On the Test Data Constructing the Mutant Set Executing Each Mutant Terminating Mutation Testing Add More Test Cases If some live imitations remain, there are 2 possible reasons: 1. The Mutation is equivalent to the original code (not very likely) 2. The Test Data is not adequately sensitive. Mutation Testing starts with test data designed by other methods, and is the only defect-directed technique for testing the completeness of test suites.

Example of Testing By Mutation function MAX(M<N:INTEGER) return INTEGER is begin if M>N then return M; else return N; end if: end MAX; First test data set--M=1, N=2 the original funtion returns 2 five mutants: replace”>“ operator in if satements by (>,<,<=or=) executing each mutant: Mutants Outputs Comparison if M>=N then2live if M<N then1dead if M<=N then1dead if M=N then2live if M N then 1dead adding test data M=2, N=1 will eliminate the latter live mutant, but the former live mutant remains live because it is equivalent to the original function. No test data can eliminate it.

The Difference of the Goals Between Fault-Based Testing and Others Fault-based testing adopts the goal of demonstrating the absence of faults rather than the imprecise goal of “finding errors”. Many take a a truism the oft-quoted statement by Myers, that “the goal of testing is to find errors” [The Art of Software Testing. 1979]. Myers goes as far as to assert that a successful test is one which causes a program failure, and that no information is gained when a program passes does not fail. Thus, Myers’ perspective is that testing is adequate if it fauls to uncover an error. This view has the unfortunate consequence that a correct program cannot be adequately tested since it contains no faults. It is impossible to simply “look for errors”; one must look for specific errors, or fall prey to not being able to attain the goal. On the other hand, demonstrating can be attained, even for a correct program. [L.J. Morell: Theoretical Insights into Fault-based Testing, 1988]

1. Introduction 1.1 Two Classes of Traditional Testing Methods Specification-based (or Funtion-based) ----Black box testing methods Code-based (or Structure-based) White box testing methods 1.2. A New Class of Testing Methods Fault-based What is Fault-based Testing? What is New in It? How Does It Work

2. Fault-based Testing 2.1 Basic Definitions Error:An error is mental mistake by a programmer of designer. Fault:A Fault is a textual problem with the code caused bt the error. Failure:A failure is an obserable incorrect behavior of the program induced by the fault. For example, a programmer may make an error in analyzing an algorithm. This may result in writing a code fault, say a reference to an incorrect variable. When the program is executed, it may fail for some inputs in the domain of the specification.

2.2 The Definition of Fault-based Testing Definition: Fault-based testing is the process of demonstrating the absence of pre-specified faults in a module under test (MUT). Explanation: The definition given here has a particular focus, scope, and goal. The focus is on faults rather than errors. The scope is limited to pre-specified faults rather than all possible faults. The goal is to demonstrate the absence of faults, not merely to look for faults (or errors).

2.3 The Context of Fault-based Testing -----The Fault-based Context A fault-based context is a 5-tuple, C=, where, M-a given module S-a specification. D-a domain of the specification. L-an n-tuple of instruction locations in M:(L,L,...,L ). A- (A,A,...,A ) where A is an alternative set associated with location L, 1£ i£ n. 12n 12n i i Definitions: Location- A location in a module denotes some expression which is language dependent (part of an instruction). Alternative-An alternative is an expression e which can be legally substituted for the expression in the statement at location L in the module under test.

2.4 The Basic Framework of Fault-based Testing Fault-based testing starts with a fault-based context:, and seeks to demonstrate that no member of A is present in the module The basic steps of fault-based testing can be well understood from typical fault-based testing techniques. 2.5 Typical Fault-based Testing Techniques Various Mutation Testing Methods(*) Error-sensitive testing (Foster) Perturbation testing (Zeil) Domain Testing (White & Cohen) Fault-based functional testing (Howden) Symbolic Testing (Morell) In the rest of the presentation, we will emphasize mutation testing.

3. Mutation Testing -- A Powerful Fault-based Testing Technique 3.1 Basic Concepts Mutation Making a small change in a module Mutation Testing To systematically and repeatedly make a small change (e.g., replacing one operator by another, replacing one variable by another, or altering the value of a constant) in the code, and for each change to compare the outputs of the original and the changed module when exercised on the same test suite. Such a change is called a mutation, and a changed module is called a mutant of the original module.

3.2 Several Mutation Testing Techniques According to the time for comparing outcomes of the original and mutant module, Mutation Testing can be divided into three categories: Strong Mutation (R.A. DeMillo et al.) Weak Mutation (W.E. Howden) Firm Mutation (M.R. Woodward et al.) In Strong Mutation, the time is after execution of the entire module. In Weak Mutation, the time is immediately after each single execution of a component (which has been mutated) of the module. In Firm Mutation, the time is at some point in between Strong Mutation time and Weak Mutation time. Note that we will put our emphasis on Strong Mutation Testing only.

3.3 Basic Hypothesis of (Strong) Mutation Testing Mutation testing is based on the following two hypotheses: (1) Competent programmer hypothesis The module under test has been written by a competent programmer or designer. Therefore, if the module is not correct, it differs from a correct one by at most a few small faults. (2) Coupling Effect hypothesis The test suite that distinguishes all modules from a correct one by only simple faults is so sensitive that it also implicitly distinguishes more complex faults. Note that there is no hope of “proving” the Coupling Effect mathematically; it is an empirical hypothesis.

3.4 Basic Steps of (Strong) Mutation Testing For a given module M and a proposed test data set D: (1) Executing M on the test data set D. If outputs are incorrect, M has faults. If outputs are correct, M may have faults also - Test data is not adequate. (2) Constructing mutants of M. Each mutant is identical to M except for a single syntactic change (a mutation). (How to do this?) (3) Executing each mutant on D. If producing a different output, the mutant was dead. If producing the same output, the mutant remains live (D is inadequate; or the mutant is equivalent to M). (4) Terminating mutation testing Test data set D is adequate: no live mutants left or only equivalent mutants left. Otherwise, go to the next step. (5) Adding more test cases and repeating According to information provided by the live mutants, design and add more test cases to D, and repeat the above process from the very beginning.