(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 1 Test Case Selection and Adequacy Criteria.

Slides:



Advertisements
Similar presentations
(c) 2007 Mauro Pezzè & Michal Young Ch 17, slide 1 Test Execution.
Advertisements

Lecture 8: Testing, Verification and Validation
Coverage Criteria Drawn mostly from Ammann&Offutt and Pezze&Yooung.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
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.
Introduction to Software Engineering Lecture 11 André van der Hoek.
1 Software Engineering Lecture 11 Software Testing.
(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 1 Test Case Selection and Adequacy Criteria.
(c) 2007 Mauro Pezzè & Michal Young Ch 13, slide 1 Data flow testing.
1 Design by Contract Building Reliable Software. 2 Software Correctness Correctness is a relative notion  A program is correct with respect to its specification.
Background on Testing and Maintenance CISC 879 Fall 2008.
(c) 2007 Mauro Pezzè & Michal Young Ch 16, slide 1 Fault-Based Testing.
Chapter 8: Path Testing Csci 565.
1 Software Testing and Quality Assurance Lecture 15 - Planning for Testing (Chapter 3, A Practical Guide to Testing Object- Oriented Software)
(c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1 Structural Testing.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
(c) 2007 Mauro Pezzè & Michal Young Ch 24, slide 1 Documenting Analysis and Test.
(c) 2007 Mauro Pezzè & Michal Young Ch 10, slide 1 Functional testing.
Testing an individual module
(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.
System/Software Testing
Software Testing and Validation SWE 434
CMSC 345 Fall 2000 Unit Testing. The testing process.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
Introduction to Software Testing
Agenda Introduction Overview of White-box testing Basis path testing
Something to amuse you… CS UWO minutes.
1 Software Testing. 2 Path Testing 3 Structural Testing Also known as glass box, structural, clear box and white box testing. A software testing technique.
(c) 2007 Mauro Pezzè & Michal Young The Big Picture.
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.
Software Construction Lecture 18 Software Testing.
Coverage Estimating the quality of a test suite. 2 Code Coverage A code coverage model calls out the parts of an implementation that must be exercised.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
What is Testing? Testing is the process of finding errors in the system implementation. –The intent of testing is to find problems with the system.
Introduction to Software Testing Paul Ammann & Jeff Offutt Updated 24-August 2010.
Chair of Software Engineering Exercise Session 6: V & V Software Engineering Prof. Dr. Bertrand Meyer March–June 2007.
Introduction to Software Testing. OUTLINE Introduction to Software Testing (Ch 1) 2 1.Spectacular Software Failures 2.Why Test? 3.What Do We Do When We.
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing III No reading Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
Dynamic Testing.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Testing Integral part of the software development process.
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Software TestIng White box testing.
Overview Theory of Program Testing Goodenough and Gerhart’s Theory
Testing Verification and the Joy of Breaking Code
Structural Testing.
CompSci 230 Software Construction
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 2 Theory of Program Testing
Coverage-Based Test Design CS 4501 / 6501 Software Testing
Testing the Software with Blinders on
Structural testing, Path Testing
White-Box Testing Techniques
Types of Testing Visit to more Learning Resources.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Dataflow Testing G. Rothermel.
Introduction to Software Testing Chapter 2 Model-Driven Test Design
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
White-Box Testing Techniques I
Software Testing COM /12/2019 Testing/Spring 98.
A Framework for Testing and Analysis
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Unit III – Chapter 3 Path Testing.
Presentation transcript:

(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 2 Learning objectives Understand the purpose of defining test adequacy criteria, and their limitations Understand basic terminology of test selection and adequacy Know some sources of information commonly used to define adequacy criteria Understand how test selection and adequacy criteria are used

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 3 Adequacy: We can’t get what we want What we would like: –A real way of measuring effective testing If the system system passes an adequate suite of test cases, then it must be correct (or dependable) But that’s impossible! –Adequacy of test suites, in the sense above, is provably undecidable. So we’ll have to settle on weaker proxies for adequacy –Design rules to highlight inadequacy of test suites

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 4 Adequacy Criteria as Design Rules Many design disciplines employ design rules –E.g.: “traces (on a chip, on a circuit board) must be at least ___ wide and separated by at least ___” –“The roof must have a pitch of at least ____ to shed snow” –“Interstate highways must not have a grade greater than 6% without special review and approval” Design rules do not guarantee good designs –Good design depends on talented, creative, disciplined designers; design rules help them avoid or spot flaws –Test design is no different

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 5 Practical (in)Adequacy Criteria Criteria that identify inadequacies in test suites. –Examples –if the specification describes different treatment in two cases, but the test suite does not check that the two cases are in fact treated differently, we may conclude that the test suite is inadequate to guard against faults in the program logic. –If no test in the test suite executes a particular program statement, the test suite is inadequate to guard against faults in that statement. If a test suite fails to satisfy some criterion, the obligation that has not been satisfied may provide some useful information about improving the test suite. If a test suite satisfies all the obligations by all the criteria, we do not know definitively that it is an effective test suite, but we have some evidence of its thoroughness.

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 6 Analogy: Building Codes Building codes are sets of design rules –Maximum span between beams in ceiling, floor, and walls; acceptable materials; wiring insulation;... –Minimum standards, subject to judgment of building inspector who interprets the code You wouldn’t buy a house just because it’s “up to code” –It could be ugly, badly designed, inadequate for your needs But you might avoid a house because it isn’t –Building codes are inadequacy criteria, like practical test “adequacy” criteria

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 7 Some useful terminology Test case: a set of inputs, execution conditions, and a pass/fail criterion. Test case specification: a requirement to be satisfied by one or more test cases. Test obligation: a partial test case specification, requiring some property deemed important to thorough testing. Test suite: a set of test cases. Test or test execution: the activity of executing test cases and evaluating their results. Adequacy criterion: a predicate that is true (satisfied) or false (not satisfied) of a  program, test suite  pair.

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 8 Where do test obligations come from? Functional (black box, specification-based): from software specifications Example: If spec requires robust recovery from power failure, test obligations should include simulated power failure Structural (white or glass box): from code Example: Traverse each program loop one or more times. Model-based: from model of system Models used in specification or design, or derived from code Example: Exercise all transitions in communication protocol model Fault-based: from hypothesized faults (common bugs) Example: Check for buffer overflow handling (common vulnerability) by testing on very large inputs

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 9 Adequacy criteria Adequacy criterion = set of test obligations A test suite satisfies an adequacy criterion if –all the tests succeed (pass) –every test obligation in the criterion is satisfied by at least one of the test cases in the test suite. –Example: the statement coverage adequacy criterion is satisfied by test suite S for program P if each executable statement in P is executed by at least one test case in S, and the outcome of each test execution was “pass”.

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 10 Satisfiability Sometimes no test suite can satisfy a criterion for a given program –Example: Defensive programming style includes “can’t happen” sanity checks if (z < 0) { throw new LogicError( “z must be positive here!”) } No test suite can satisfy statement coverage for this program (if it’s correct)

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 11 Coping with Unsatisfiability Approach A: exclude any unsatisfiable obligation from the criterion. –Example: modify statement coverage to require execution only of statements that can be executed. –But we can’t know for sure which are executable! Approach B: measure the extent to which a test suite approaches an adequacy criterion. –Example: if a test suite satisfies 85 of 100 obligations, we have reached 85% coverage. Terms: An adequacy criterion is satisfied or not, a coverage measure is the fraction of satisfied obligations

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 12 Coverage: Useful or Harmful? Measuring coverage (% of satisfied test obligations) can be a useful indicator... –Of progress toward a thorough test suite, of trouble spots requiring more attention... or a dangerous seduction –Coverage is only a proxy for thoroughness or adequacy –It’s easy to improve coverage without improving a test suite (much easier than designing good test cases) –The only measure that really matters is (cost- )effectiveness

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 13 Comparing Criteria Can we distinguish stronger from weaker adequacy criteria? Empirical approach: Study the effectiveness of different approaches to testing in industrial practice –What we really care about, but... –Depends on the setting; may not generalize from one organization or project to another Analytical approach: Describe conditions under which one adequacy criterion is provably stronger than another –Stronger = gives stronger guarantees –One piece of the overall “effectiveness” question

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 14 The subsumes relation Test adequacy criterion A subsumes test adequacy criterion B iff, for every program P, every test suite satisfying A with respect to P also satisfies B with respect to P. Example: Exercising all program branches (branch coverage) subsumes exercising all program statements A common analytical comparison of closely related criteria –Useful for working from easier to harder levels of coverage, but not a direct indication of quality

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 15 Uses of Adequacy Criteria Test selection approaches –Guidance in devising a thorough test suite Example: A specification-based criterion may suggest test cases covering representative combinations of values Revealing missing tests –Post hoc analysis: What might I have missed with this test suite? Often in combination –Example: Design test suite from specifications, then use structural criterion (e.g., coverage of all branches) to highlight missed logic

(c) 2007 Mauro Pezzè & Michal Young Ch 9, slide 16 Summary Adequacy criteria provide a way to define a notion of “thoroughness” in a test suite –But they don’t offer guarantees; more like design rules to highlight inadequacy Defined in terms of “covering” some information –Derived from many sources: Specs, code, models,... May be used for selection as well as measurement –With caution! An aid to thoughtful test design, not a substitute