Input Space Partitioning

Similar documents
Input Space Partitioning

Introduction to Software Testing Chapter 4 Input Space Partition Testing

Input Space Partitioning

Equivalence Class Partitioning. Equivalence Partitioning. Definition and Example. Example set of classes

9.5 Equivalence Relations

Software Testing for Developer Development Testing. Duvan Luong, Ph.D. Operational Excellence Networks

Specification-Based Testing 1

Introduction. Easy to get started, based on description of the inputs

Programming Languages Third Edition

1.2 Venn Diagrams and Partitions

Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Sets Fall / 31

MITOCW watch?v=kz7jjltq9r4


Comparing procedure specifications

Lecture 10 Notes Linked Lists

CMSC 433 Section 0101 Fall 2012 Midterm Exam #1

Repetition Through Recursion

Lecture 10 Notes Linked Lists

Review of Sets. Review. Philippe B. Laval. Current Semester. Kennesaw State University. Philippe B. Laval (KSU) Sets Current Semester 1 / 16

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

CS 1110: Introduction to Computing Using Python Loop Invariants

Figure 4.1: The evolution of a rooted tree.

Lesson 1: Creating and formatting an Answers analysis

Microsoft Office Illustrated Introductory, Building and Using Queries

Black-box Testing Techniques

Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute

Topic: Orientation, Surfaces, and Euler characteristic

SYSTEM 2000 Essentials

Reasoning about programs

Last time. Reasoning about programs. Coming up. Project Final Presentations. This Thursday, Nov 30: 4 th in-class exercise

Microsoft Access Illustrated. Unit B: Building and Using Queries

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

Verification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80

Cardinality of Sets. Washington University Math Circle 10/30/2016

Continuous functions and homeomorphisms

Introduction to Homotopy Type Theory

CS 512, Spring 2017: Take-Home End-of-Term Examination

Pages and 68 in [JN] conventions for using exceptions in Java. Chapter 8 in [EJ] guidelines for more effective use of exceptions.

Recall from previous lecture

Chapter 1: Principles of Programming and Software Engineering

Chapter 3: The IF Function and Table Lookup

Equivalence Class Partitioning and Boundary Value Analysis -Black Box Testing Techniques

Chapter 10: File Input / Output

Developing Requirements- Based Tests. CSCE Lecture 8-09/21/2015

Generell Topologi. Richard Williamson. May 27, 2013

Specifications. CSE 331 Spring 2010

Outline. Computer Science 331. Three Classical Algorithms. The Sorting Problem. Classical Sorting Algorithms. Mike Jacobson. Description Analysis

CS 3 Introduction to Software Engineering. 5: Iterators

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 6. Advanced Data Modeling. Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

CS 451 Software Engineering Winter 2009

Simplicial Complexes: Second Lecture

The Game Chromatic Number of Some Classes of Graphs

Open and Closed Sets

1. Managing Information in Table

(Refer Slide Time: 0:19)

6.170 Lecture 6 Procedure specifications MIT EECS

CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011

Solutions to Problem Set 1

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 8 Data Modeling Advanced Concepts

Classes, interfaces, & documentation. Review of basic building blocks

MICROSOFT EXCEL 2003 LEVEL 3

DataMaster for Windows

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

CSC Discrete Math I, Spring Sets

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

Chapter 8: Class and Method Design

MICROSOFT EXCEL 2002 (XP): LEVEL 3

CMPT 473 Software Quality Assurance. Graph Coverage. Nick Sumner

Follow these steps to get started: o Launch MS Access from your start menu. The MS Access startup panel is displayed:

Chapter 11. Topological Spaces: General Properties

GEO 425: SPRING 2012 LAB 9: Introduction to Postgresql and SQL

MICROSOFT EXCEL VERSIONS 2007 & 2010 LEVEL 3. WWP Learning and Development Ltd Page 1

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

New Perspectives on Microsoft Access Module 3: Maintaining and Querying a Database

Software processes, quality, and standards Black box testing

User Manual Mail Merge

Principles of Programming Languages

CSE 20 DISCRETE MATH WINTER

SOFTWARE ENGINEERING DESIGN I

Lecture 24: Loop Invariants

CS 31: Intro to Systems Caching. Kevin Webb Swarthmore College March 24, 2015

EECS 4313 Software Engineering Testing. Topic 05: Equivalence Class Testing Zhen Ming (Jack) Jiang

(Refer Slide Time 03:00)

Developing Requirements-Based Tests. CSCE Lecture 8-09/13/2016

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

Manifolds. Chapter X. 44. Locally Euclidean Spaces

SQL*Loader Concepts. SQL*Loader Features

Lecture 12: Abstraction Functions

Worldox GX Cheat Sheet

Specifications. Prof. Clarkson Fall Today s music: Nice to know you by Incubus

Chapter 2, Part I Introduction to C Programming

AXIOMS OF AN IMPERATIVE LANGUAGE PARTIAL CORRECTNESS WEAK AND STRONG CONDITIONS. THE AXIOM FOR nop

--- stands for the horizontal line.

Reasoning About Imperative Programs. COS 441 Slides 10

Fractals: Self-Similarity and Fractal Dimension Math 198, Spring 2013

Analysis of Algorithms. Unit 4 - Analysis of well known Algorithms

CS61A Summer 2010 George Wang, Jonathan Kotker, Seshadri Mahalingam, Eric Tzeng, Steven Tang

INTRODUCTION TO SOFTWARE ENGINEERING

OWL DL / Full Compatability

Transcription:

CMPT 473 Software Quality Assurance Input Space Partitioning Nick Sumner

Recall Testing involves running software and comparing observed behavior against expected behavior Select an input, look at the output 2

Recall Testing involves running software and comparing observed behavior against expected behavior Select an input, look at the output Problem: The input domain is infinite or pragmatically infinite. for test in allpossibleinputs: run_program(test) 3

Recall Testing involves running software and comparing observed behavior against expected behavior Select an input, look at the output Problem: The input domain is infinite or pragmatically infinite. Testing is about selecting a finite subset of inputs that can help measure quality 4

Input Space Partitioning Take the direct approach: Focus on the input! 5

Input Space Partitioning Input Space Partitioning Divide (partition) the set of possible inputs into equivalence classes 6

Input Space Partitioning Input Space Partitioning Divide (partition) the set of possible inputs into equivalence classes Test one input from each class 7

Input Space Partitioning Input Space Partitioning Divide (partition) the set of possible inputs into equivalence classes Test one input from each class e.g. abs(x) Input Domain:, -3, -2, -1, 0, 1, 2, 3,... How many tests if done exhaustively? 8

Input Space Partitioning Input Space Partitioning Divide (partition) the set of possible inputs into equivalence classes Test one input from each class e.g. abs(x) Input Domain: Partitions:, -3, -2, -1, 0, 1, 2, 3,..., -3, -2, -1, 0, 1, 2, 3,... What might reasonable partitions be? 9

Input Space Partitioning Input Space Partitioning Divide (partition) the set of possible inputs into equivalence classes Test one input from each class e.g. abs(x) Input Domain: Partitions:, -3, -2, -1, 0, 1, 2, 3,..., -3, -2, -1, 0, 1, 2, 3,... 10

Input Space Partitioning Input Space Partitioning Divide (partition) the set of possible inputs into equivalence classes Test one input from each class e.g. abs(x) Input Domain:, -3, -2, -1, 0, 1, 2, 3,... Partitions:, -3, -2, -1, 0, 1, 2, 3,... How many tests for the partitions? 11

Input Space Partitioning Input Space Partitioning Divide (partition) the set of possible inputs into equivalence classes Test one input from each class e.g. abs(x) Input Domain: Partitions:, -3, -2, -1, 0, 1, 2, 3,..., -3, -2, -1, 0, 1, 2, 3,... Impressive! How do we do it? 12

Input Space Partitioning 1) Identify the component 13

Input Space Partitioning 1) Identify the component Whole program Module Class Function 14

Input Space Partitioning 1) Identify the component Whole program Module Class Function 2) Identify the inputs What might the inputs be? 15

Input Space Partitioning 1) Identify the component Whole program Module Class Function 2) Identify the inputs Function/method parameters 16

Input Space Partitioning 1) Identify the component Whole program Module Class Function 2) Identify the inputs Function/method parameters Object state 17

Input Space Partitioning 1) Identify the component Whole program Module Class Function 2) Identify the inputs Function/method parameters Object state Global variables 18

Input Space Partitioning 1) Identify the component Whole program Module Class Function 2) Identify the inputs Function/method parameters Object state Global variables File contents 19

Input Space Partitioning 1) Identify the component Whole program Module Class Function 2) Identify the inputs Function/method parameters Object state Global variables File contents User provided inputs 20

Input Space Partitioning 1) Identify the component Whole program Module Class Function 2) Identify the inputs Function/method parameters Object state Global variables File contents User provided inputs 21

Input Space Partitioning 3) Develop an Input Domain Model 22

Input Space Partitioning 3) Develop an Input Domain Model A way of describing the possible inputs Partitioned by characteristics 23

Partitioned Input Domain Partition the domain D on characteristics D = A C B 24

Partitioned Input Domain Partition the domain D on characteristics What are characteristics? D = A C B 25

Partitioned Input Domain Partition the domain D on characteristics Must satisfy 2 criteria: Disjoint: A B C = Cover: A B C = D D = A C B 26

Partitioned Input Domain Partition the domain D on characteristics Must satisfy 2 criteria: Disjoint: A B C = Cover: A B C = D D = A C B What do these criteria intuitively provide? 27

Using Partitions Select one input from each block Each input in a block is assumed equally useful 28

Using Partitions Select one input from each block Each input in a block is assumed equally useful How? Identify characteristics of the possible inputs (from requirements, types, etc.) 29

Using Partitions Select one input from each block Each input in a block is assumed equally useful How? Identify characteristics of the possible inputs (from requirements, types, etc.) Partition into blocks based on each characteristic 30

Using Partitions Select one input from each block Each input in a block is assumed equally useful How? Identify characteristics of the possible inputs (from requirements, types, etc.) Partition into blocks based on each characteristic Create tests by selecting values for each block 31

Using Partitions Select one input from each block Each input in a block is assumed equally useful How? Identify characteristics of the possible inputs (from requirements, types, etc.) Partition into blocks based on each characteristic Create tests by selecting values for each block How many tests might this imply? Might there be more? Fewer? 32

Using Partitions Select one input from each block Each input in a block is assumed equally useful How? Identify characteristics of the possible inputs (from requirements, types, etc.) Partition into blocks based on each characteristic Create tests by selecting values for each block How many tests might this imply? Might there be more? Fewer? We're hiding some details in this last step. It's not quite right yet. 33

Using Partitions Select one input from each block Each input in a block is assumed equally useful How? Identify characteristics of the possible inputs (from requirements, types, etc.) Partition into blocks based on each characteristic Create tests by selecting values for each block Characteristics: List s is sorted ascending X is null String length... 34

Partitioning is Subtle Suppose we have: classifyparallelogram(p1) Characteristic: The subtype of parallelogram 35

Partitioning is Subtle Suppose we have: classifyparallelogram(p1) Characteristic: The subtype of parallelogram What are the types of parallelograms? 36

Partitioning is Subtle Suppose we have: classifyparallelogram(p1) Characteristic: The subtype of parallelogram How can we partition based on this characteristic? What problems might arise? 37

Partitioning is Subtle Suppose we have: classifyparallelogram(p1) Characteristic: The subtype of parallelogram How can we partition based on this characteristic? What problems might arise? In class exercise: Partitioning a triangle classifying program 38

Partitioning is Subtle Suppose we have: classifyparallelogram(p1) Characteristic: The subtype of parallelogram How can we partition based on this characteristic? What problems might arise? In class exercise: Partitioning a triangle classifying program It is easy to create overlapping partitions. Care and design required to avoid it. 39

Partitioning is Subtle Suppose we have: classifyparallelogram(p1) Characteristic: The subtype of parallelogram How can we partition based on this characteristic? What problems might arise? In class exercise: Partitioning a triangle classifying program It is easy to create overlapping partitions. Care and design required to avoid it. Why do disjoint partitions matter? 40

Process (Reiterated) 3 step process (for now): 1)Find the component / function to test methods, classes, programs, functions 41

Process (Reiterated) 3 step process (for now): 1)Find the component / function to test methods, classes, programs, functions 2) Find all test parameters Must identify everything locals, globals, files, databases, schedules, servers,... 42

Process (Reiterated) 3 step process (for now): 1)Find the component / function to test methods, classes, programs, functions 2) Find all test parameters Must identify everything locals, globals, files, databases, schedules, servers,... 3) Model the input domain Identify characteristics Partition the input domain Select values for each region 43

Process (Reiterated) 3 step process (for now): 1)Find the component / function to test methods, classes, programs, functions 2) Find all test parameters Must identify everything Domain knowledge, tactics, and creativity apply here. locals, globals, files, databases, schedules, servers,... 3) Model the input domain Identify characteristics Partition the input domain Select values for each region 44

Approaches to Input Modeling We still haven't talked about how to model input! 45

Approaches to Input Modeling 2 Main approaches: 46

Approaches to Input Modeling 2 Main approaches: 1)Interface based Guided directly by identified parameters & domains 47

Approaches to Input Modeling 2 Main approaches: 1)Interface based Guided directly by identified parameters & domains Simple Automatable 48

Approaches to Input Modeling 2 Main approaches: 1)Interface based Guided directly by identified parameters & domains Simple Automatable 2)Functionality/Requirements based Derived from expected input/output relationship by spec. 49

Approaches to Input Modeling 2 Main approaches: 1)Interface based Guided directly by identified parameters & domains Simple Automatable 2)Functionality/Requirements based Derived from expected input/output relationship by spec. Requires more design & more thought May be better (smaller, goal oriented, ) 50

Interface Based Modeling Consider parameters individually 51

Interface Based Modeling Consider parameters individually Examine their types/domains Ignore relationships & dependences 52

Interface Based Modeling Consider parameters individually Examine their types/domains Ignore relationships & dependences How does this apply to our triangle classifier? 53

Functionality Based Modeling Identify characteristics corresponding to behaviors/functionality in the requirements 54

Functionality Based Modeling Identify characteristics corresponding to behaviors/functionality in the requirements Includes knowledge from the problem domain 55

Functionality Based Modeling Identify characteristics corresponding to behaviors/functionality in the requirements Includes knowledge from the problem domain Accounts for relationships between parameters 56

Functionality Based Modeling Identify characteristics corresponding to behaviors/functionality in the requirements Includes knowledge from the problem domain Accounts for relationships between parameters Same parameter may appear in multiple characteristics Need to reason about constraints & conflicts! 57

Functionality Based Modeling Identify characteristics corresponding to behaviors/functionality in the requirements Includes knowledge from the problem domain Accounts for relationships between parameters Same parameter may appear in multiple characteristics Need to reason about constraints & conflicts! How might this apply to our triangle classifier? 58

Finding Typical Characteristics What might typical characteristics be? 59

Finding Typical Characteristics What might typical characteristics be? Preconditions Postconditions 60

Finding Typical Characteristics What might typical characteristics be? Preconditions Postconditions Invariants 61

Finding Typical Characteristics What might typical characteristics be? Preconditions Postconditions Relationships to special values Relationships between variables 62

Finding Typical Values How might you select values for a block? 63

Finding Typical Values How might you select values for a block? Expected values (e.g. exampled from spec) Invalid, valid, & special values Boundary values 64

Finding Typical Values How might you select values for a block? Expected values (e.g. exampled from spec) Invalid, valid, & special values Boundary values Thought experiment: What do boundary values as a selection approach indicate? 65

An Interface Based Example Consider our triangle classifier Takes 3 integers for sides 1, 2, & 3 66

An Interface Based Example Consider our triangle classifier Takes 3 integers for sides 1, 2, & 3 Characteristic b1 b2 b3 Side 1 <?> 0 Side 1 > 0 Side 1 = 0 Side 1 < 0 Side 2 <?> 0 Side 2 > 0 Side 2 = 0 Side 2 < 0 Side 3 <?>0 Side 3 > 0 Side 3 = 0 Side 3 < 0 67

An Interface Based Example Consider our triangle classifier Takes 3 integers for sides 1, 2, & 3 Characteristic b1 b2 b3 Side 1 <?> 0 Side 1 > 0 Side 1 = 0 Side 1 < 0 Side 2 <?> 0 Side 2 > 0 Side 2 = 0 Side 2 < 0 Side 3 <?>0 Side 3 > 0 Side 3 = 0 Side 3 < 0 How many tests does this create? 68

An Interface Based Example Consider our triangle classifier Takes 3 integers for sides 1, 2, & 3 Characteristic b1 b2 b3 Side 1 <?> 0 Side 1 > 0 Side 1 = 0 Side 1 < 0 Side 2 <?> 0 Side 2 > 0 Side 2 = 0 Side 2 < 0 Side 3 <?>0 Side 3 > 0 Side 3 = 0 Side 3 < 0 How many tests does this create? What will this test well? What won't this test well? 69

Refining the Example We can subdivide partitions to cover more behavior Characteristic b1 b2 b3 b4 Value of side 1 Side 1 > 1 Side 1 = 1 Side 1 = 0 Side 1 < 0 Value of side 2 Side 2 > 1 Side 2 = 1 Side 2 = 0 Side 2 < 0 Value of side 3 Side 3 > 1 Side 3 = 1 Side 3 = 0 Side 3 < 0 {Side n > 0} {Side n = 1},{ Side n > 1} 70

Refining the Example We can subdivide partitions to cover more behavior Characteristic b1 b2 b3 b4 Value of side 1 Side 1 > 1 Side 1 = 1 Side 1 = 0 Side 1 < 0 Value of side 2 Side 2 > 1 Side 2 = 1 Side 2 = 0 Side 2 < 0 Value of side 3 Side 3 > 1 Side 3 = 1 Side 3 = 0 Side 3 < 0 How many tests now? 71

Refining the Example We can subdivide partitions to cover more behavior Characteristic b1 b2 b3 b4 Value of side 1 Side 1 > 1 Side 1 = 1 Side 1 = 0 Side 1 < 0 Value of side 2 Side 2 > 1 Side 2 = 1 Side 2 = 0 Side 2 < 0 Value of side 3 Side 3 > 1 Side 3 = 1 Side 3 = 0 Side 3 < 0 How many tests now? Is it still disjoint? Complete? 72

Refining the Example We can subdivide partitions to cover more behavior Characteristic b1 b2 b3 b4 Value of side 1 Side 1 > 1 Side 1 = 1 Side 1 = 0 Side 1 < 0 Value of side 2 Side 2 > 1 Side 2 = 1 Side 2 = 0 Side 2 < 0 Value of side 3 Side 3 > 1 Side 3 = 1 Side 3 = 0 Side 3 < 0 How many tests now? Is it still disjoint? Complete? What does it test well? Not well? 73

A Functionality Based Example Consider our triangle classifier again What might our characteristics & partitions be? 74

A Functionality Based Example Consider our triangle classifier again What might our characteristics & partitions be? Are there alternatives? 75

A Functionality Based Example Consider our triangle classifier again What might our characteristics & partitions be? Are there alternatives? Why might you use them? 76

A Classic Example Start with a component / specification: Command Syntax Function FIND FIND <pattern> <file> The FIND command is used to locate one or more instances of a given pattern in a text file. All lines in the file that contain the pattern are written to standard output. A line containing the pattern is written only once, regardless of the number of times the pattern occurs on it. The pattern is any sequence of characters whose length does not exceed the maximum length of a line in the file. To include a blank in the pattern, the entire pattern must be enclosed in quotes ("). To include a quotation mark in the pattern, two quotes in a row ("") must be used. 77

A Classic Example Step 1: Analyze the specification What is the component? What are the parameters? What are the characteristics? 78

A Classic Example Step 1: Analyze the specification What Parameters: is the component? What are Pattern the parameters? Input file (& its contents!) What are the characteristics? 79

A Classic Example Step 1: Analyze the specification What Parameters: is the component? What are Pattern the parameters? Input file (& its contents!) What are the characteristics? Characteristics: Pattern Input file Pattern Size Quoting Embedded Quotes File Name Environment / System Characteristics: # of pattern occurrences in file # of occurrences on a particular line: 80

A Classic Example Step 2: Partition the Input Space Guided by intelligence and intuition Combine interface and functionality based approaches as necessary 81

A Classic Example Step 2: Partition the Input Space Guided by intelligence and intuition Combine interface and functionality based approaches as necessary Parameters: Pattern Size: Empty Single character Many characters Longer than any line in the file Quoting:... 82

A Classic Example Familiar Idea: Select one block per characteristic at a time Combine into test frames (test case plans) e.g. 83

A Classic Example Familiar Idea: Select one block per characteristic at a time Combine into test frames (test case plans) e.g. Pattern size : empty Quoting : pattern is quoted Embedded blanks : several embedded blanks Embedded quotes : no embedded quotes File name : good file name Number of occurrences of pattern in file : none Pattern occurrences on target line : one 84

A Classic Example Familiar Idea: Select one block per characteristic at a time Combine into test frames (test case plans) e.g. Problem? Pattern size : empty Quoting : pattern is quoted Embedded blanks : several embedded blanks Embedded quotes : no embedded quotes File name : good file name Number of occurrences of pattern in file : none Pattern occurrences on target line : one 85

A Classic Example Familiar Idea: Select one block per characteristic at a time Combine into test frames (test case plans) e.g. Problem? Pattern size : empty Quoting : pattern is quoted Embedded blanks : several embedded blanks Embedded quotes : no embedded quotes File name : good file name Number of occurrences of pattern in file : none Pattern occurrences on target line : one 86

A Classic Example Step 3: Identify constraints among the characteristics & blocks Pattern Size: Empty [Property Empty] Single character [Property NonEmpty] Many characters [Property NonEmpty] Longer than any line in the file [Property NonEmpty] 87

A Classic Example Step 3: Identify constraints among the characteristics & blocks Pattern Size: Empty [Property Empty] Single character [Property NonEmpty] Many characters [Property NonEmpty] Longer than any line in the file [Property NonEmpty] Quoting: Pattern is quoted Pattern is not quoted Pattern is improperly quoted [Property Quoted] [If NonEmpty] [If NonEmpty] 88

A Classic Example Step 3: Identify constraints among the characteristics & blocks Pattern Size: Empty [Property Empty] Single character [Property NonEmpty] Many characters [Property NonEmpty] Longer than any line in the file [Property NonEmpty] Quoting: Pattern is quoted Pattern is not quoted Pattern is improperly quoted [Property Quoted] [If NonEmpty] [If NonEmpty] What should this do to the number of tests? To the quality of tests? 89

A Classic Example Step 4 Create tests by selecting values that satisfy the selected blocks for each frame Eliminate tests that cover redundant scenarios 90

A Classic Example Step 4 Create tests by selecting values that satisfy the selected blocks for each frame Eliminate tests that cover redundant scenarios Why might scenarios be redundant? 91

A Classic Example Step 5: Take your generated test cases and automate them 92