Introduction to Software Testing Chapter 6-4 Input Space Partition Testing Paul Ammann & Jeff Offutt

Slides:



Advertisements
Similar presentations
Introduction to Software Testing Chapter 1
Advertisements

Sequence of characters Generalized form Expresses Pattern of strings in a Generalized notation.
Practice Session 5 Java: Packages Collection Classes Iterators Generics Design by Contract Test Driven Development JUnit.
Introduction to Software Testing Chapter 3.3 Logic Coverage for Source Code Paul Ammann & Jeff Offutt
1 Applications of Optimization to Logic Testing Gary Kaminski and Paul Ammann ICST 2010 CSTVA Workshop.
Introduction to Software Testing Chapter 6 Input Space Partition Testing Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Software Testing Logic Coverage. Introduction to Software Testing (Ch 3) © Ammann & Offutt 2 Logic Coverage Four Structures for Modeling Software Graphs.
Introduction to Software Testing Chapter 8.3 Logic Coverage for Source Code Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 1 Paul Ammann & Jeff Offutt SUMMARY OF PARTS 1 AND 2 FROM LAST WEEK.
Logic ChAPTER 3 1. Truth Tables and Validity of Arguments
Bag implementation Add(T item) – Enlarge bag if necessary; allocate larger array Remove(T item) – Reduce bag if necessary; allocate smaller array Iterator.
2/17/2008Sultan Almuhammadi1 ICS Logic & Sets (An Overview) Week 1.
1 Topic 8 Iterators "First things first, but not necessarily in that order " -Dr. Who.
Introduction to Software Testing Chapter 8.2
Phil 120 week 1 About this course. Introducing the language SL. Basic syntax. Semantic definitions of the connectives in terms of their truth conditions.
CS 307 Fundamentals of Computer ScienceIterators 1 Topic 14 Iterators "First things first, but not necessarily in that order " -Dr. Who.
3.2 – Truth Tables and Equivalent Statements
TRUTH TABLES. Introduction Statements have truth values They are either true or false but not both Statements may be simple or compound Compound statements.
Logic ChAPTER 3.
Introduction to Software Testing Chapter 9.4 Model-Based Grammars Paul Ammann & Jeff Offutt
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Today’s Agenda  Quick Review  Finish Graph-Based Testing  Predicate Testing Software Testing and Maintenance 1.
Black-Box Testing Techniques II Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 5.
Introduction to Software Testing Chapter 8.1 Logic Coverage Paul Ammann & Jeff Offutt
CSC 205 Programming II Lecture 18 The Eight Queens Problem.
1 Iterators "First things first, but not necessarily in that order " -Dr. Who CS Computer Science II.
Introduction to Software Testing Chapter 3.6 Disjunctive Normal Form Criteria Paul Ammann & Jeff Offutt
Boolean Logic. Boolean Operators (T/F) xyx AND y FFF FTF TFF TTT xyx OR y FFF FTT TFT TTT xNOT x FT TF.
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt
Warmup Answer the following True/False questions in your head: I have brown hair AND I am wearing glasses I am male OR I am wearing sneakers I am NOT male.
Chapter 3 Collections. Objectives  Define the concepts and terminology related to collections  Explore the basic structures of the Java Collections.
Boolean Logic.
Using Logic Criterion Feasibility to Reduce Test Set Size While Guaranteeing Double Fault Detection Gary Kaminski and Paul Ammann Software Engineering.
Notes - Truth Tables fun, fun, and more fun!!!!. A compound statement is created by combining two or more statements, p and q.
Introduction to Software Testing Chapter 3.6 Disjunctive Normal Form Criteria Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.6 Disjunctive Normal Form Criteria Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.1 Logic Coverage Paul Ammann & Jeff Offutt.
Iteration Abstraction SWE Software Construction Fall 2009.
Topic 13 Iterators. 9-2 Motivation We often want to access every item in a data structure or collection in turn We call this traversing or iterating over.
Introduction to Software Testing Chapter 3.4 Logic Coverage for Specifications Paul Ammann & Jeff Offutt
Iterators. Iterator  An iterator is any object that allows one to step through each element in a list (or, more generally, some collection).
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 8.2
Introduction to Software Testing Chapter 8.1 Logic Coverage
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
EECE 310: Software Engineering
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
ISP Coverage Criteria CS 4501 / 6501 Software Testing
Introduction to Software Testing Syntactic Logic Coverage Criteria
Input Space Partition Testing CS 4501 / 6501 Software Testing
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Iteration Abstraction
In-Class Extended Example Ch. 6.4
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3 Test Automation
CSE 143 Lecture 27: Advanced List Implementation
Iteration Abstraction
ISP Coverage Criteria CS 4501 / 6501 Software Testing
Introduction to Software Testing Chapter 8.1 Logic Coverage
"First things first, but not necessarily in that order " -Dr. Who
Presentation transcript:

Introduction to Software Testing Chapter 6-4 Input Space Partition Testing Paul Ammann & Jeff Offutt

In-Class Extended Example Ch 6.4 Form teams of two to three neighbors Hand out printouts of Iterator.html – Close books We will go through the steps for designing an IDM for Iterator After each step, we will stop & discuss as a class Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt2

Task I: Determine Characteristics Step 1: Identify: Functional units Parameters Return types and return values Exceptional behavior Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt3 work …

Task I: Determine Characteristics Step 1: Identify: hasNext () – Returns true if more elements E next() – Returns next element –Exception: NoSuchElementException void remove () – Removes the most recent element returned by the iterator –Exception: Unsupported-OperationException –Exception: IllegalStateException State of the iterator –and, as we’ll discover, the state of the collection we are iterating over! Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt4

Task I: Determine Characteristics Step 2: Develop Characteristics Table A: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt5 MethodParamsReturnsValuesExceptionCh IDCharacter -istic Covered by hasNextstatebooleantrue, false nextstate E element generic E, null removestate work …

Task I: Determine Characteristics Step 2: Develop Characteristics Table A: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt6 MethodParamsReturnsValuesExceptionCh IDCharacter -istic Covered by hasNextstatebooleantrue, falseC1More values nextstate E element generic E, null removestate

Task I: Determine Characteristics Step 2: Develop Characteristics Table A: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt7 MethodParamsReturnsValuesExceptionCh IDCharacter -istic Covered by hasNextstatebooleantrue, falseC1More values nextstate E element generic E, null C2Returns non-null object removestate

Task I: Determine Characteristics Step 2: Develop Characteristics Table A: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt8 MethodParamsReturnsValuesExceptionCh IDCharacter -istic Covered by hasNextstatebooleantrue, falseC1More values nextstate E element generic E, null C2Returns non-null object NoSuchEle ment C1 removestate

Task I: Determine Characteristics Step 2: Develop Characteristics Table A: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt9 MethodParamsReturnsValuesExceptionCh IDCharacter -istic Covered by hasNextstatebooleantrue, falseC1More values nextstate E element generic E, null C2Returns non-null object NoSuchEle ment C1 removestate Unsupport ed C3remove() supported

Task I: Determine Characteristics Step 2: Develop Characteristics Table A: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt10 MethodParamsReturnsValuesExceptionCh IDCharacter -istic Covered by hasNextstatebooleantrue, falseC1More values nextstate E element generic E, null C2Returns non-null object NoSuchEle ment C1 removestate Unsupport ed C3remove() supported IllegalStateC4remove() constraint satisfied Done!

Task I: Determine Characteristics Step 4: Design a partitioning Table B: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt11 hasNextnextremovePartition (all are boolean) C1 C2 C3 C4 work …

Task I: Determine Characteristics Step 4: Design a partitioning Table B: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt12 hasNextnextremovePartition (all are boolean) C1XXX C2XX C3X C4X

Task I: Determine Characteristics Step 4: Design a partitioning Table B: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt13 hasNextnextremovePartition (all are boolean) C1XXX{true, false} C2XX{true, false} C3X{true, false} C4X{true, false} Done with task I!

Task II: Define Test Requirements Step 1: Choose coverage criterion Step 2: Choose base cases if needed Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt14 work …

Task II: Define Test Requirements Step 1: Base coverage criterion (BCC) Step 2: Happy path (all true) Step 3: Test requirements … Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt15

Task II: Define Test Requirements Step 3: Test requirements Table C: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt16 work … MethodCharacteristicsTest RequirementsInfeasible TRs hasNextC1 nextC1 C2 removeC1 C2 C3 C4

Task II: Define Test Requirements Step 3: Test requirements Table C: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt17 MethodCharacteristicsTest RequirementsInfeasible TRs hasNextC1{T, F} nextC1 C2{TT, FT, TF} removeC1 C2 C3 C4{TTTT, FTTT, TFTT, TTFT, TTTF}

Task II: Define Test Requirements Step 4: Infeasible test requirements Table C: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt18 MethodCharacteristicsTest RequirementsInfeasible TRs hasNextC1{T, F}none nextC1 C2{TT, FT, TF}FT removeC1 C2 C3 C4{TTTT, FTTT, TFTT, TTFT, TTTF} FTTT C1=F: has no values C2=T: returns non-null object

Task II: Define Test Requirements Step 5: Revised infeasible test requirements Table C: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt19 MethodCharacteristicsTest RequirementsInfeasible TRs Revised TRs# TRs hasNextC1{T, F}nonen/a2 nextC1 C2{TT, FT, TF}FTFT  FF3 removeC1 C2 C3 C4{TTTT, FTTT, TFTT, TTFT, TTTF} FTTTFTTT  FFTT5 Done with task II!

Task III: Automate Tests First, we need an implementation of Iterator –( Iterator is just an interface) –ArrayList implements Iterator Test fixture has two variables: –List of strings –Iterator for strings setUp() –Creates a list with two strings –Initializes an iterator Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt20

Task III: Automate Tests remove () adds another complication … Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt21 “The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.” This is a precondition! List list = new ArrayList (); list.add(“cat”); list.add(“dog”); Iterator itr = list.iterator(); String s = itr.next(); // s has the value “cat” list.add(“elephant”); // just changed Collection! s = itr.next(); // precondition violated! // return value undefined!

Task III: Automate Tests Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt22 A competent tester would stop there All specified behaviors have been tested! But subtypes of Iterator are free do define behavior for the precondition In fact, Java Collection classes use an exception to do exactly that: ConcurrentModificationException

Task I: Determine Characteristics Cycle back to add another exception—Table A revised: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt23 MethodParamsReturnsValuesExceptionCh IDCharacter -istic Covered by work …

Task I: Determine Characteristics Cycle back to add another exception—Table A revised: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt24 MethodParamsReturnsValuesExceptionCh IDCharacter -istic Covered by hasNextstatebooleantrue, falseC1More values Concurrent Modification C5 nextstate E element generic E, null C2Returns non- null NoSuchEleme nt C1 Concurrent Modification C5 removestate UnsupportedC3remove() supported IllegalStateC4remove() constraint satisfied Concurrent Modification C5Collection not modified

Task II: Define Test Requirements Cycle back to Step 5: Revised infeasible test requirements Table C revised: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt25 MethodCharacteristicsTest RequirementsInfeasible TRs Revised TRs# TRs work …

Task II: Define Test Requirements Cycle back to Step 5: Revised infeasible test requirements Table C revised: Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt26 MethodCharacteristicsTest RequirementsInfeasible TRs Revised TRs# TRs hasNextC1 C5{TT, FT, TF}nonen/a3 nextC1 C2 C5{TTT, FTT, TFT, TTF}FTT TTF FTT  FFT TTF  TFF 4 removeC1 C2 C3 C4 C5 {TTTTT, FTTTT, TFTTT, TTFTT, TTTFT, TTTTF} FTTTTFTTTT  FFTTT 6

Task III: Automate Tests Introduction to Software Testing, Edition 2 (Ch 6)© Ammann & Offutt27 All tests are on the book website: Implementation of iterator() explains anomalies in tests: ArrayList source code