(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 1 Fault-Based Testing.

Slides:



Advertisements
Similar presentations
Composition CMSC 202. Code Reuse Effective software development relies on reusing existing code. Code reuse must be more than just copying code and changing.
Advertisements

Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
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.
(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 1 Test Case Selection and Adequacy Criteria.
(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 1 Test Case Selection and Adequacy Criteria.
An Analysis and Survey of the Development of Mutation Testing by Yue Jia and Mark Harmon A Quick Summary For SWE6673.
(c) 2007 Mauro Pezzè & Michal Young Ch 13, slide 1 Data flow testing.
Statistical Techniques I EXST7005 Lets go Power and Types of Errors.
Copyright © 2010 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
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.
Multiple Linear Regression Model
Exam 1 Review u Scores Min 30 Max 96 Ave 63.9 Std Dev 14.5.
Software Quality Control Methods. Introduction Quality control methods have received a world wide surge of interest within the past couple of decades.
This material in not in your text (except as exercises) Sequence Comparisons –Problems in molecular biology involve finding the minimum number of edit.
Lec 5 Feb 10 Goals: analysis of algorithms (continued) O notation summation formulas maximum subsequence sum problem (Chapter 2) three algorithms image.
(c) 2007 Mauro Pezzè & Michal Young Ch 10, slide 1 Functional testing.
(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell.
(c) 2007 Mauro Pezzè & Michal Young Ch 3, slide 1 Basic Principles.
(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 1 A Framework for Testing and Analysis.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
1 1 Slide Statistical Inference n We have used probability to model the uncertainty observed in real life situations. n We can also the tools of probability.
Introduction to Software Testing Chapter 5.2 Program-based Grammars Paul Ammann & Jeff Offutt
Software Testing and Validation SWE 434
© SERG Dependable Software Systems (Mutation) Dependable Software Systems Topics in Mutation Testing and Program Perturbation Material drawn from [Offutt.
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.
(c) 2007 Mauro Pezzè & Michal Young The Big Picture.
Copyright © 2009 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
1 Chapter 18 Sampling Distribution Models. 2 Suppose we had a barrel of jelly beans … this barrel has 75% red jelly beans and 25% blue jelly beans.
Test Drivers and Stubs More Unit Testing Test Drivers and Stubs CEN 5076 Class 11 – 11/14.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18 Sampling Distribution Models.
Sampling Distribution Models Chapter 18. Toss a penny 20 times and record the number of heads. Calculate the proportion of heads & mark it on the dot.
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 22 Comparing Two Proportions.
Exam 1 Review u Scores Min 30 Max 96 Ave 63.9 Std Dev 14.5.
“Isolating Failure Causes through Test Case Generation “ Jeremias Rößler Gordon Fraser Andreas Zeller Alessandro Orso Presented by John-Paul Ore.
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 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
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
Statistical Techniques
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing III No reading Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
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.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
Statistics 16 Random Variables. Expected Value: Center A random variable assumes a value based on the outcome of a random event. –We use a capital letter,
The Law of Averages. What does the law of average say? We know that, from the definition of probability, in the long run the frequency of some event will.
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.
Chapter 10 Confidence Intervals for Proportions © 2010 Pearson Education 1.
Thinking Like a Scientist
Sampling Distribution Models
White-Box Testing Techniques IV
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Unit 5: Hypothesis Testing
FAULT BASED TESTING,TEST EXECUTION
Comparing Two Proportions
Introduction to Software Testing Chapter 5.2 Program-based Grammars
A Few Review Questions.
Comparing Two Proportions
Mutation Testing Tutorial Answers
Software Testing Syntax-based Testing.
Chapter 12 Power Analysis.
Mutation Testing The Mutants are Coming! Copyright © 2017 – Curt Hill.
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:

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 1 Fault-Based Testing

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 2 Learning objectives Understand the basic ideas of fault-based testing –How knowledge of a fault model can be used to create useful tests and judge the quality of test cases –Understand the rationale of fault-based testing well enough to distinguish between valid and invalid uses Understand mutation testing as one application of fault-based testing principles

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 3 Let’s count marbles... a lot of marbles Suppose we have a big bowl of marbles. How can we estimate how many? –I don’t want to count every marble individually –I have a bag of 100 other marbles of the same size, but a different color –What if I mix them? Photo credit: (c) KaCey97007 on Flickr, Creative Commons license

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 4 Estimating marbles I mix 100 black marbles into the bowl –Stir well... I draw out 100 marbles at random 20 of them are black How many marbles were in the bowl to begin with?

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 5 Estimating Test Suite Quality Now, instead of a bowl of marbles, I have a program with bugs I add 100 new bugs Assume they are exactly like real bugs in every way I make 100 copies of my program, each with one of my 100 new bugs I run my test suite on the programs with seeded bugs... –... and the tests reveal 20 of the bugs –(the other 80 program copies do not fail) What can I infer about my test suite?

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 6 Basic Assumptions We’d like to judge effectiveness of a test suite in finding real faults, by measuring how well it finds seeded fake faults. Valid to the extent that the seeded bugs are representative of real bugs –Not necessarily identical (e.g., black marbles are not identical to clear marbles); but the differences should not affect the selection E.g., if I mix metal ball bearings into the marbles, and pull them out with a magnet, I don’t learn anything about how many marbles were in the bowl

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 7 Mutation testing A mutant is a copy of a program with a mutation A mutation is a syntactic change (a seeded bug) –Example: change (i < 0) to (i <= 0) Run test suite on all the mutant programs A mutant is killed if it fails on at least one test case If many mutants are killed, infer that the test suite is also effective at finding real bugs

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 8 What do I need to believe? Mutation testing uses seeded faults (syntactic mutations) as black marbles Does it make sense? What must I assume? What must be true of black marbles, if they are to be useful in counting a bowl of pink and red marbles?

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 9 Mutation testing assumptions Competent programmer hypothesis: –Programs are nearly correct Real faults are small variations from the correct program => Mutants are reasonable models of real buggy programs Coupling effect hypothesis: –Tests that find simple faults also find more complex faults Even if mutants are not perfect representatives of real faults, a test suite that kills mutants is good at finding real faults too

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 10 Mutation Operators Syntactic change from legal program to legal program So: Specific to each programming language. C++ mutations don’t work for Java, Java mutations don’t work for Python Examples: –crp: constant for constant replacement for instance: from (x < 5) to (x < 12) select from constants found somewhere in program text –ror: relational operator replacement for instance: from (x <= 5) to (x < 5) –vie: variable initialization elimination change int x =5; to int x;

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 11 Live Mutants Scenario: –We create 100 mutants from our program –We run our test suite on all 100 mutants, plus the original program –The original program passes all tests –94 mutant programs are killed (fail at least one test) –6 mutants remain alive What can we learn from the living mutants?

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 12 How mutants survive A mutant may be equivalent to the original program –Maybe changing (x < 0) to (x <= 0) didn’t change the output at all! The seeded “fault” is not really a “fault”. Determining whether a mutant is equivalent may be easy or hard; in the worst case it is undecideable Or the test suite could be inadequate –If the mutant could have been killed, but was not, it indicates a weakness in the test suite –But adding a test case for just this mutant is a bad idea. We care about the real bugs, not the fakes!

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 13 Variations on Mutation Weak mutation Statistical mutation

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 14 Weak mutation Problem: There are lots of mutants. Running each test case to completion on every mutant is expensive Number of mutants grows with the square of program size Approach: –Execute meta-mutant (with many seeded faults) together with original program –Mark a seeded fault as “killed” as soon as a difference in intermediate state is found Without waiting for program completion Restart with new mutant selection after each “kill”

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 15 Statistical Mutation Problem: There are lots of mutants. Running each test case on every mutant is expensive It’s just too expensive to create N 2 mutants for a program of N lines (even if we don’t run each test case separately to completion) Approach: Just create a random sample of mutants –May be just as good for assessing a test suite Provided we don’t design test cases to kill particular mutants (which would be like selectively picking out black marbles anyway)

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 16 In real life... Fault-based testing is a widely used in semiconductor manufacturing –With good fault models of typical manufacturing faults, e.g., “stuck-at-one” for a transistor –But fault-based testing for design errors is more challenging (as in software) Mutation testing is not widely used in industry –But plays a role in software testing research, to compare effectiveness of testing techniques Some use of fault models to design test cases is important and widely practiced

(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 17 Summary If bugs were marbles... –We could get some nice black marbles to judge the quality of test suites Since bugs aren’t marbles... –Mutation testing rests on some troubling assumptions about seeded faults, which may not be statistically representative of real faults Nonetheless... –A model of typical or important faults is invaluable information for designing and assessing test suites