boundary value analysis

56
Functional Testing Part 1 Boundary Value Testing – Equivalence Class Testing

Upload: api-3809615

Post on 10-Apr-2015

1.572 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Boundary Value Analysis

Functional Testing Part 1Boundary Value Testing – Equivalence Class Testing

Page 2: Boundary Value Analysis

2

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 3: Boundary Value Analysis

3

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 4: Boundary Value Analysis

4

Boundary Value AnalysisBoundary Value Analysis

F(xF(x11, x, x22), a ), a ≤ x≤ x1 1 ≤ b, c ≤ x≤ b, c ≤ x2 2 ≤ d≤ d Boundary value analysis focuses on the Boundary value analysis focuses on the

boundary of the input space to identify test boundary of the input space to identify test casescases

The rationale behind boundary value The rationale behind boundary value testing is that errors tend to occur near the testing is that errors tend to occur near the extreme values of an input variableextreme values of an input variable e.g. loop conditions (< instead of ≤), counterse.g. loop conditions (< instead of ≤), counters

Page 5: Boundary Value Analysis

5

Boundary Value AnalysisBoundary Value Analysis

Basic idea: use input variable values at their Basic idea: use input variable values at their minimum (min), just above the minimum (min+), minimum (min), just above the minimum (min+), a nominal value (nom), just below their a nominal value (nom), just below their maximum (max-), and at their maximum (max)maximum (max-), and at their maximum (max)

““Single fault” assumption in reliability theory: Single fault” assumption in reliability theory: failures are only rarely the result of the failures are only rarely the result of the simultaneous occurrence of two (or more) faults.simultaneous occurrence of two (or more) faults.

The boundary value analysis test cases are The boundary value analysis test cases are obtained by holding the values of all but one obtained by holding the values of all but one variable at their nominal values, and letting that variable at their nominal values, and letting that variable assume its extreme valuesvariable assume its extreme values

Page 6: Boundary Value Analysis

6

Boundary Value AnalysisBoundary Value Analysis

a

c

b

d

x1

x2 Input Space (domain)

F(x1, x2)

a

c

b

d

x1

x2Test Cases (function

of two variables)<x1nom, x2min>

<x1nom, x2min+>

<x1nom, x2nom>

<x1nom, x2max->

<x1nom, x2max>

<x1min, x2nom>

<x1min+, x2nom>

<x1nom, x2nom>

<x1max-, x2nom>

<x1max, x2nom>

Page 7: Boundary Value Analysis

7

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 8: Boundary Value Analysis

8

Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis

By the number of variablesBy the number of variables For n variables For n variables → 4n + 1 test cases→ 4n + 1 test cases

By the kinds of ranges, depends on the type (nature) of By the kinds of ranges, depends on the type (nature) of the variablesthe variables Variables have discrete, bounded valuesVariables have discrete, bounded values

e.g. NextDate function, commission probleme.g. NextDate function, commission problem Variables have no explicit boundsVariables have no explicit bounds

Create “artificial” boundsCreate “artificial” bounds e.g. triangle probleme.g. triangle problem

Boolean variablesBoolean variables Decision table-based testingDecision table-based testing

Logical variables (bound to a value or another logic variable)Logical variables (bound to a value or another logic variable) e.g. PIN and transaction type in SATM Systeme.g. PIN and transaction type in SATM System

Page 9: Boundary Value Analysis

9

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 10: Boundary Value Analysis

10

Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Boundary value analysis works well when Boundary value analysis works well when the program to be tested is a function of the program to be tested is a function of several several independentindependent variables that variables that represent bounded represent bounded physicalphysical quantities quantities e.g. NextDate test cases are inadequate (little e.g. NextDate test cases are inadequate (little

stress on February, dependencies among stress on February, dependencies among month, day, and year)month, day, and year)

e.g. variables refer to physical quantities, e.g. variables refer to physical quantities, such as temperature, air speed, load etc.such as temperature, air speed, load etc.

Page 11: Boundary Value Analysis

11

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 12: Boundary Value Analysis

12

Robustness TestingRobustness Testing

Simple extension of boundary value analysisSimple extension of boundary value analysis In addition to the five boundary value analysis In addition to the five boundary value analysis

values of a variable, see what happens when the values of a variable, see what happens when the extrema are exceeded with a value slightly extrema are exceeded with a value slightly greater than the maximum (max+) and a value greater than the maximum (max+) and a value slightly less than the minimum (min-)slightly less than the minimum (min-)

Focuses on the expected outputsFocuses on the expected outputs e.g. exceeding load capacity of a public elevatore.g. exceeding load capacity of a public elevator

Forces attention on exception handlingForces attention on exception handling

Page 13: Boundary Value Analysis

13

Robustness TestingRobustness Testing

a

c

b

d

x1

x2Robustness Test Cases

(function of two variables) <x1nom, x2min>

<x1nom, x2min+>

<x1nom, x2nom>

<x1nom, x2max->

<x1nom, x2max>

<x1min, x2nom>

<x1min+, x2nom>

<x1nom, x2nom>

<x1max-, x2nom>

<x1max, x2nom>

<x1max+, x2nom>

<x1min-, x2nom>

<x1nom, x2max+>

<x1nom, x2min->

Page 14: Boundary Value Analysis

14

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 15: Boundary Value Analysis

15

Worst Case TestingWorst Case Testing

Worst case analysis: more than one variable has an Worst case analysis: more than one variable has an extreme valueextreme value

Procedure:Procedure: For each variable create the set <min, min+, nom, max-, max>For each variable create the set <min, min+, nom, max-, max> Take the Cartesian product of these sets to generate test casesTake the Cartesian product of these sets to generate test cases

More thorough than boundary value analysisMore thorough than boundary value analysis Represents more effortRepresents more effort

For n variables → 5For n variables → 5nn test cases (as opposed to 4n+1 test cases test cases (as opposed to 4n+1 test cases for boundary value analysis)for boundary value analysis)

Follows the generalization patternFollows the generalization pattern Same limitationsSame limitations Robust worst case testing can be appliedRobust worst case testing can be applied

Page 16: Boundary Value Analysis

16

Worst Case TestingWorst Case Testing

a

c

b

d

x1

x2Worst Case Test

Cases (function of twovariables)

<x1nom, x2min>

<x1nom, x2min+>

<x1nom, x2nom>

<x1nom, x2max->

<x1nom, x2max>

<x1min, x2min>

<x1min, x2min+>

<x1min, x2nom>

<x1min, x2max->

<x1min, x2max>

<x1min+, x2min>

<x1min+, x2min+>

<x1min+, x2nom>

<x1min+, x2max->

<x1min+, x2max>

<x1max-, x2min>

<x1max-, x2min+>

<x1max-, x2nom>

<x1max-, x2max->

<x1max-, x2max>

<x1max, x2min>

<x1max, x2min+>

<x1max, x2nom>

<x1max, x2max->

<x1max, x2max>

Page 17: Boundary Value Analysis

17

Worst Case TestingWorst Case Testing

<x1nom, x2min>

<x1nom, x2min+>

<x1nom, x2nom>

<x1nom, x2max->

<x1nom, x2max>

<x1min+, x2min>

<x1min+, x2min+>

<x1min+, x2nom>

<x1min+, x2max->

<x1min+, x2max>

<x1min+, x2min->

<x1min+, x2max+>

<x1nom, x2min->

<x1nom, x2max+>

<x1max+, x2min>

<x1max+, x2min+>

<x1max+, x2nom>

<x1max+, x2max->

<x1max+, x2max>

<x1max+, x2min->

<x1max+, x2max+>

<x1min, x2min>

<x1min, x2min+>

<x1min, x2nom>

<x1min, x2max->

<x1min, x2max>

<x1min, x2min->

<x1min, x2max+>

<x1min-, x2min>

<x1min-, x2min+>

<x1min-, x2nom>

<x1min-, x2max->

<x1min-, x2max>

<x1min-, x2min->

<x1min-, x2max+>

<x1max-, x2min>

<x1max-, x2min+>

<x1max-, x2nom>

<x1max-, x2max->

<x1max-, x2max>

<x1max, x2min>

<x1max, x2min+>

<x1max, x2nom>

<x1max, x2max->

<x1max, x2max>

<x1max-, x2min->

<x1max-, x2max+>

<x1max, x2min->

<x1max, x2max+>a

c

b

d

x1

x2Robust Worst Case Test

Cases (function of twovariables)

Page 18: Boundary Value Analysis

18

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 19: Boundary Value Analysis

19

Special Value TestingSpecial Value Testing

The most widely practiced form of functional The most widely practiced form of functional testingtesting

Most intuitive, least uniform, no guidelinesMost intuitive, least uniform, no guidelines The tester uses his/her domain knowledge, The tester uses his/her domain knowledge,

experience with similar programs, “ad hoc experience with similar programs, “ad hoc testing”testing”

It is dependent on the abilities of the testerIt is dependent on the abilities of the tester Even though it is highly subjective, it often Even though it is highly subjective, it often

results in a set of test cases which is more results in a set of test cases which is more effective in revealing faults than the test sets effective in revealing faults than the test sets generated by the other methodsgenerated by the other methods

Page 20: Boundary Value Analysis

20

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 21: Boundary Value Analysis

21

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem

Case a b c Expected Output1 100 100 1 Isosceles2 100 100 2 Isosceles3 100 100 100 Equilateral4 100 100 199 Isosceles5 100 100 200 Not a Triangle6 100 1 100 Isosceles7 100 2 100 Isosceles8 100 199 100 Isosceles9 100 200 100 Not a Triangle

10 1 100 100 Isosceles11 2 100 100 Isosceles12 199 100 100 Isosceles13 200 100 100 Not a Triangle

Boundary Value Analysis Test Cases

min = 1min+ = 2

nom = 100max- = 199max = 200

Page 22: Boundary Value Analysis

22

Test Cases for the Triangle ProblemTest Cases for the Triangle ProblemCase a b c Expected Output

1 1 1 1 Equilateral2 1 1 2 Not a Triangle3 1 1 100 Not a Triangle4 1 1 199 Not a Triangle5 1 1 200 Not a Triangle6 1 2 1 Not a Triangle7 1 2 2 Isosceles8 1 2 100 Not a Triangle9 1 2 199 Not a Triangle

10 1 2 200 Not a Triangle11 1 100 1 Not a Triangle12 1 100 2 Not a Triangle13 1 100 100 Isosceles14 1 100 199 Not a Triangle15 1 100 200 Not a Triangle16 1 199 1 Not a Triangle17 1 199 2 Not a Triangle18 1 199 100 Not a Triangle19 1 199 199 Isosceles20 1 199 200 Not a Triangle21 1 200 1 Not a Triangle22 1 200 2 Not a Triangle23 1 200 100 Not a Triangle24 1 200 199 Not a Triangle25 1 200 200 Isosceles26 2 1 1 Not a Triangle27 2 1 2 Isosceles28 2 1 100 Not a Triangle29 2 1 199 Not a Triangle30 2 1 200 Not a Triangle

Case a b c Expected Output31 2 2 1 Isosceles32 2 2 2 Equilateral33 2 2 100 Not a Triangle34 2 2 199 Not a Triangle35 2 2 200 Not a Triangle36 2 100 1 Not a Triangle37 2 100 2 Not a Triangle38 2 100 100 Isosceles39 2 100 199 Not a Triangle40 2 100 200 Not a Triangle41 2 199 1 Not a Triangle42 2 199 2 Not a Triangle43 2 199 100 Not a Triangle44 2 199 199 Isosceles45 2 199 200 Scalene46 2 200 1 Not a Triangle47 2 200 2 Not a Triangle48 2 200 100 Not a Triangle49 2 200 199 Scalene50 2 200 200 Isosceles51 100 1 1 Not a Triangle52 100 1 2 Not a Triangle53 100 1 100 Isosceles54 100 1 199 Not a Triangle55 100 1 200 Not a Triangle56 100 2 1 Not a Triangle57 100 2 2 Not a Triangle58 100 2 100 Isosceles59 100 2 199 Not a Triangle60 100 2 200 Not a Triangle

Worst Case Test Cases (60 of 125)

Page 23: Boundary Value Analysis

23

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 24: Boundary Value Analysis

24

Test Cases for the NextDate ProblemTest Cases for the NextDate Problem

Boundary Value Analysis Test CasesCase month day year Expected Output

1 6 15 1812 June 16, 18122 6 15 1813 June 16, 18133 6 15 1912 June 16, 19124 6 15 2011 June 16, 20115 6 15 2012 June 16, 20126 6 1 1912 June 2, 19127 6 2 1912 June 3, 19128 6 30 1912 July 1, 19129 6 31 1912 error

10 1 15 1912 January 16, 191211 2 15 1912 February 16, 191212 11 15 1912 November 16, 191213 12 15 1912 December 16, 1912

monthmin = 1

min+ = 2nom = 6

max- = 11max = 12

daymin = 1

min+ = 2nom = 15max- = 30max = 31

yearmin = 1812

min+ = 1813nom = 1912max- = 2011max = 2012

Page 25: Boundary Value Analysis

25

Worst Case Test Cases (60 of 125)

Test Cases for the NextDate ProblemTest Cases for the NextDate ProblemCase month day year Expected Output

1 1 1 1812 January 2, 18122 1 1 1813 January 2, 18133 1 1 1912 January 2, 19124 1 1 2011 January 2, 20115 1 1 2012 January 2, 20126 1 2 1812 January 3, 18127 1 2 1813 January 3, 18138 1 2 1912 January 3, 19129 1 2 2011 January 3, 201110 1 2 2012 January 3, 201211 1 15 1812 January 16, 181212 1 15 1813 January 16, 181313 1 15 1912 January 16, 191214 1 15 2011 January 16, 201115 1 15 2012 January 16, 201216 1 30 1812 January 31, 181217 1 30 1813 January 31, 181318 1 30 1912 January 31, 191219 1 30 2011 January 31, 201120 1 30 2012 January 31, 201221 1 31 1812 February 1, 181222 1 31 1813 February 1, 181323 1 31 1912 February 1, 191224 1 31 2011 February 1, 201125 1 31 2012 February 1, 201226 2 1 1812 February 2, 181227 2 1 1813 February 2, 181328 2 1 1912 February 2, 191229 2 1 2011 February 2, 201130 2 1 2012 February 2, 2012

Case month day year Expected Output31 2 2 1812 February 3, 181232 2 2 1813 February 3, 181333 2 2 1912 February 3, 191234 2 2 2011 February 3, 201135 2 2 2012 February 3, 201236 2 15 1812 February 16, 181237 2 15 1813 February 16, 181338 2 15 1912 February 16, 191239 2 15 2011 February 16, 201140 2 15 2012 February 16, 201241 2 30 1812 error42 2 30 1813 error43 2 30 1912 error44 2 30 2011 error45 2 30 2012 error46 2 31 1812 error47 2 31 1813 error48 2 31 1912 error49 2 31 2011 error50 2 31 2012 error51 6 1 1812 June 2, 181252 6 1 1813 June 2, 181353 6 1 1912 June 2, 191254 6 1 2011 June 2, 201155 6 1 2012 June 2, 201256 6 2 1812 June 3, 181257 6 2 1813 June 3, 181358 6 2 1912 June 3, 191259 6 2 2011 June 3, 201160 6 2 2012 June 3, 2012

Page 26: Boundary Value Analysis

26

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 27: Boundary Value Analysis

27

Test Cases for the Commission ProblemTest Cases for the Commission Problem

13 Boundary Value Analysis Test Cases13 Boundary Value Analysis Test Cases 125 Worst Case Test Cases125 Worst Case Test Cases Boundary values for the output range, especially Boundary values for the output range, especially

near the threshold points of $1000 and $1800near the threshold points of $1000 and $1800 Part of the reason for using the output range to Part of the reason for using the output range to

determine test cases is that test cases from the determine test cases is that test cases from the input range are almost all in the 20% zoneinput range are almost all in the 20% zone

We want to find input variable combinations that We want to find input variable combinations that stress the boundary values: $100, $1000, stress the boundary values: $100, $1000, $1800, and $7800$1800, and $7800

Page 28: Boundary Value Analysis

28

Test Cases for the Commission ProblemTest Cases for the Commission Problem

Case locks stocks barrels sales commission comment1 1 1 1 100 10 output minimum2 1 1 2 125 12.5 output minimum +3 1 2 1 130 13 output minimum +4 2 1 1 145 14.5 output minimum +5 5 5 5 500 50 midpoint6 10 10 9 975 97.5 border point -7 10 9 10 970 97 border point -8 9 10 10 955 95.5 border point -9 10 10 10 1000 100 border point10 10 10 11 1025 103.75 border point +11 10 11 10 1030 104.5 border point +12 11 10 10 1045 106.75 border point +13 14 14 14 1400 160 midpoint14 18 18 17 1775 216.25 border point -15 18 17 18 1770 215.5 border point -16 17 18 18 1755 213.25 border point -17 18 18 18 1800 220 border point18 18 18 19 1825 225 border point +19 18 19 18 1830 226 border point +20 19 18 18 1845 229 border point +21 48 48 48 4800 820 midpoint22 70 80 89 7775 1415 output maximum -23 70 79 90 7770 1414 output maximum -24 69 80 90 7755 1411 output maximum -25 70 80 90 7800 1420 output maximum

Output Boundary Value Analysis Test Cases

Page 29: Boundary Value Analysis

29

Test Cases for the Commission ProblemTest Cases for the Commission Problem

Test case 9 is the $1000 border pointTest case 9 is the $1000 border point If we tweak the input variables we get If we tweak the input variables we get

values just below and just above the values just below and just above the borderborder

Form of special value testing based on Form of special value testing based on mathematical insightmathematical insight

Case locks stocks barrels sales commission comment1 10 11 9 1005 100.75 border point +2 18 17 19 1795 219.25 border point -3 18 19 17 1805 221 border point +

Output Special Value Test Cases

Page 30: Boundary Value Analysis

30

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 31: Boundary Value Analysis

31

Equivalence ClassesEquivalence Classes

MotivationsMotivations Have a sense of complete testingHave a sense of complete testing Avoid redundancyAvoid redundancy

Equivalence classes form a partition of a set, where partition refers Equivalence classes form a partition of a set, where partition refers to a collection of mutually disjoint subsets whose union is the entire to a collection of mutually disjoint subsets whose union is the entire set (completeness, non-redundancy)set (completeness, non-redundancy)

The idea is to identify test cases by using one element from each The idea is to identify test cases by using one element from each equivalence classequivalence class

““treated the same” treated the same” → “traversing the same execution path”→ “traversing the same execution path” The key is the choice of the equivalence relation that determines the The key is the choice of the equivalence relation that determines the

classesclasses ““second guess” the likely implementation , and think about the functional second guess” the likely implementation , and think about the functional

manipulations that must somehow be present in the implementationmanipulations that must somehow be present in the implementation

Page 32: Boundary Value Analysis

32

Equivalence ClassesEquivalence Classes

Program under consideration:Program under consideration: Function of variables a, b, cFunction of variables a, b, c Input domain consists of sets A, B, and CInput domain consists of sets A, B, and C A = A1 A2 A3A = A1 A2 A3 B = B1 B2 B3 B4B = B1 B2 B3 B4 C = C1 C2C = C1 C2 a1 A1, b3 B3, c2 C2a1 A1, b3 B3, c2 C2

Page 33: Boundary Value Analysis

33

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 34: Boundary Value Analysis

34

Weak Equivalence Class TestingWeak Equivalence Class Testing

Accomplished by using one variable from Accomplished by using one variable from each equivalence class in a test caseeach equivalence class in a test case

Number of weak equivalence class test Number of weak equivalence class test cases = number of classes in the partition cases = number of classes in the partition with the largest number of subsetswith the largest number of subsets

Test Case a b cWE1 a1 b1 c1WE2 a2 b2 c2WE3 a3 b3 c1WE4 a1 b4 c2

A = A1 A2 A3B = B1 B2 B3 B4

C = C1 C2a1 A1, b3 B3, c2 C2

Page 35: Boundary Value Analysis

35

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 36: Boundary Value Analysis

36

Strong Equivalence Class TestingStrong Equivalence Class Testing

Based on the Cartesian Based on the Cartesian Product of the partition Product of the partition subsetssubsets

A x B x C = 3 x 4 x 2 = 24 A x B x C = 3 x 4 x 2 = 24 elementselements

Equivalence relations can Equivalence relations can be defined on the output be defined on the output range of the program range of the program function being testedfunction being tested

Test Case a b cSE1 a1 b1 c1SE2 a1 b1 c2SE3 a1 b2 c1SE4 a1 b2 c2SE5 a1 b3 c1SE6 a1 b3 c2SE7 a1 b4 c1SE8 a1 b4 c2SE9 a2 b1 c1SE10 a2 b1 c2SE11 a2 b2 c1SE12 a2 b2 c2SE13 a2 b3 c1SE14 a2 b3 c2SE15 a2 b4 c1SE16 a2 b4 c2SE17 a3 b1 c1SE18 a3 b1 c2SE19 a3 b2 c1SE20 a3 b2 c2SE21 a3 b3 c1SE22 a3 b3 c2SE23 a3 b4 c1SE24 a3 b4 c2

Page 37: Boundary Value Analysis

37

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 38: Boundary Value Analysis

38

Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Defines equivalence classes in terms of validityDefines equivalence classes in terms of validity Commission problemCommission problem

Valid inputs: 1 ≤ lock ≤ 70, 1 ≤ stock ≤ 80, Valid inputs: 1 ≤ lock ≤ 70, 1 ≤ stock ≤ 80, 1 ≤ barrel ≤ 901 ≤ barrel ≤ 90

Invalid inputs: lock < 1, lock > 70, stock < 1, Invalid inputs: lock < 1, lock > 70, stock < 1, stock > 80, barrel < 1, barrel > 90stock > 80, barrel < 1, barrel > 90

For valid inputs, use one value from each valid For valid inputs, use one value from each valid class (like weak equivalence testing)class (like weak equivalence testing)

For invalid inputs, a test case will have one For invalid inputs, a test case will have one invalid value and the remaining values will all be invalid value and the remaining values will all be valid (single failure)valid (single failure)

Page 39: Boundary Value Analysis

39

Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Problems:Problems: Very often, the specification does not define Very often, the specification does not define

what the expected output for an invalid test what the expected output for an invalid test case should be → a lot of time spent in case should be → a lot of time spent in defining expected outputsdefining expected outputs

Strongly typed languages eliminate the need Strongly typed languages eliminate the need for the consideration of invalid inputsfor the consideration of invalid inputs

Page 40: Boundary Value Analysis

40

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 41: Boundary Value Analysis

41

Equivalence Class Test Cases for the Equivalence Class Test Cases for the Triangle ProblemTriangle Problem

Outputs: Not a Triangle, Scalene, Isosceles, EquilateralOutputs: Not a Triangle, Scalene, Isosceles, Equilateral Easier to identify output (range) equivalence classesEasier to identify output (range) equivalence classes

R1 = {<a, b, c> : the triangle with sides a, b, and c is equilateral}R1 = {<a, b, c> : the triangle with sides a, b, and c is equilateral} R2 = {<a, b, c> : the triangle with sides a, b, and c is isosceles}R2 = {<a, b, c> : the triangle with sides a, b, and c is isosceles} R3 = {<a, b, c> : the triangle with sides a, b, and c is scalene}R3 = {<a, b, c> : the triangle with sides a, b, and c is scalene} R4 = {<a, b, c> : sides a, b, and c do not form a triangle}R4 = {<a, b, c> : sides a, b, and c do not form a triangle}

Test Case a b c Expected OutputOE1 5 5 5 EquilateralOE2 2 2 3 IsoscelesOE3 3 4 5 ScaleneOE4 4 1 2 Not a Triangle

Page 42: Boundary Value Analysis

42

Equivalence Class Test Cases for the Equivalence Class Test Cases for the Triangle ProblemTriangle Problem

Input (domain) equivalence classesInput (domain) equivalence classes

D1 = {<a, b, c> : a = b = c}D2 = {<a, b, c> : a = b, a ≠ c}D3 = {<a, b, c> : a = c, a ≠ b}D4 = {<a, b, c> : b = c, a ≠ b}

D5 = {<a, b, c> : a ≠ b, a ≠ c, b ≠ c}// D6 = {<a, b, c> : a ≥ b + c}D6’ = {<a, b, c> : a = b + c}D6’’ = {<a, b, c> : a > b + c}// D7 = {<a, b, c> : b ≥ a + c}D7’ = {<a, b, c> : b = a + c}D7’’ = {<a, b, c> : b > a + c}// D8 = {<a, b, c> : c ≥ a + b}D8’ = {<a, b, c> : c = a + b}D8’’ = {<a, b, c> : c > a + b}

Page 43: Boundary Value Analysis

43

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 44: Boundary Value Analysis

44

Equivalence Class Test Cases for the Equivalence Class Test Cases for the NextDate FunctionNextDate Function

Input variablesInput variables 1 ≤ month ≤ 121 ≤ month ≤ 12 1 ≤ day ≤ 311 ≤ day ≤ 31 1812 ≤ year ≤ 20121812 ≤ year ≤ 2012

Traditional approachTraditional approach Valid equivalence classesValid equivalence classes

M1 = { month : 1 ≤ month ≤ 12 }M1 = { month : 1 ≤ month ≤ 12 } D1 = { day : 1 ≤ day ≤ 31 }D1 = { day : 1 ≤ day ≤ 31 } Y1 = { year : 1812 ≤ year ≤ 2012 }Y1 = { year : 1812 ≤ year ≤ 2012 }

Invalid equivalence classesInvalid equivalence classes M2 = { month : month < 1 }M2 = { month : month < 1 } M3 = { month : month > 12 }M3 = { month : month > 12 } D2 = { day : day < 1 }D2 = { day : day < 1 } D3 = { day : day >31 }D3 = { day : day >31 } Y2 = { year : year < 1812 }Y2 = { year : year < 1812 } Y3 = {year : year > 2012 }Y3 = {year : year > 2012 }

Case ID Month Day Year Expected OutputTE1 6 15 1912 6/16/1912TE2 -1 15 1912 invalid inputTE3 13 15 1912 invalid inputTE4 6 -1 1912 invalid inputTE5 6 32 1912 invalid inputTE6 6 15 1811 invalid inputTE7 6 15 2013 invalid input

Page 45: Boundary Value Analysis

45

Equivalence Class Test Cases for the Equivalence Class Test Cases for the NextDate FunctionNextDate Function

Traditional approach is deficient because it “treats” the Traditional approach is deficient because it “treats” the elements of a class at the valid/invalid levelelements of a class at the valid/invalid level

Different approach: What must be done to an input date?Different approach: What must be done to an input date?

M1 = { month: month has 30 days }M2 = { month: month has 31 days }M3 = { month: month is February }

D1 = { day: 1 ≤ day ≤ 28 }D2 = { day: day = 29 }D3 = { day: day = 30 }D4 = { day: day = 31 }

Y1 = { year: year = 1900 }Y2 = { year: 1812 ≤ year ≤ 2012 AND (year ≠ 1900)

AND (year mod 4 = 0) }Y3 = { year: 1812 ≤ year ≤ 2012 AND (year mod 4 ≠ 0) }

Not a perfect set of equivalence classes!!!Not a perfect set of equivalence classes!!!

Page 46: Boundary Value Analysis

46

Equivalence Class Test Cases for the Equivalence Class Test Cases for the NextDate FunctionNextDate Function

Case ID Month Day Year Expected OutputWE1 6 14 1900 6/15/1900WE2 7 29 1912 7/30/1912WE3 2 30 1913 invalid inputWE4 6 31 1900 invalid input

Weak equivalence class test cases

Case ID Month Day Year Expected OutputSE1 6 14 1900 6/15/1900SE2 6 14 1912 6/15/1912SE3 6 14 1913 6/15/1913SE4 6 29 1900 6/30/1900SE5 6 29 1912 6/30/1912SE6 6 29 1913 6/30/1913SE7 6 30 1900 07/01/1900SE8 6 30 1912 07/01/1912SE9 6 30 1913 07/01/1913SE10 6 31 1900 ERRORSE11 6 31 1912 ERRORSE12 6 31 1913 ERRORSE13 7 14 1900 7/15/1900SE14 7 14 1912 7/15/1912SE15 7 14 1913 7/15/1913SE16 7 29 1900 7/30/1900SE17 7 29 1912 7/30/1912SE18 7 29 1913 7/30/1913

Case ID Month Day Year Expected OutputSE19 7 30 1900 7/31/1900SE20 7 30 1912 7/31/1912SE21 7 30 1913 7/31/1913SE22 7 31 1900 08/01/1900SE23 7 31 1912 08/01/1912SE24 7 31 1913 08/01/1913SE25 2 14 1900 2/15/1900SE26 2 14 1912 2/15/1912SE27 2 14 1913 2/15/1913SE28 2 29 1900 ERRORSE29 2 29 1912 03/01/1912SE30 2 29 1913 ERRORSE31 2 30 1900 ERRORSE32 2 30 1912 ERRORSE33 2 30 1913 ERRORSE34 2 31 1900 ERRORSE35 2 31 1912 ERRORSE36 2 31 1913 ERROR

Strong equivalence class test cases

Page 47: Boundary Value Analysis

47

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 48: Boundary Value Analysis

48

Equivalence Class Test Cases for the Equivalence Class Test Cases for the Commission ProblemCommission Problem

Input Domain Equivalence ClassesInput Domain Equivalence Classes LockLock

L1 = { lock: 1 ≤ lock ≤ 70 }L1 = { lock: 1 ≤ lock ≤ 70 } L2 = { lock: lock < 1 }L2 = { lock: lock < 1 } L3 = { lock: lock > 70 }L3 = { lock: lock > 70 }

StockStock S1 = { stock: 1 ≤ stock ≤ 80 }S1 = { stock: 1 ≤ stock ≤ 80 } S2 = { stock: stock < 1 }S2 = { stock: stock < 1 } S3 = { stock: stock > 80 }S3 = { stock: stock > 80 }

BarrelBarrel B1 = { barrel: 1 ≤ barrel ≤ 90 }B1 = { barrel: 1 ≤ barrel ≤ 90 } B2 = { barrel: barrel < 1 }B2 = { barrel: barrel < 1 } B3 = { barrel: barrel > 90 }B3 = { barrel: barrel > 90 }

Page 49: Boundary Value Analysis

49

Equivalence Class Test Cases for the Equivalence Class Test Cases for the Commission ProblemCommission Problem

Strong Input Domain Equivalence Class Test Cases

Test Case locks stocks barrels sales commissionSE1 35 40 45 3900 640SE2 35 40 0 ERROR ERRORSE3 35 40 91 ERROR ERRORSE4 35 0 45 ERROR ERRORSE5 35 0 0 ERROR ERRORSE6 35 0 91 ERROR ERRORSE7 35 81 45 ERROR ERRORSE8 35 81 0 ERROR ERRORSE9 35 81 91 ERROR ERRORSE10 0 40 45 ERROR ERRORSE11 0 40 0 ERROR ERRORSE12 0 40 91 ERROR ERRORSE13 0 0 45 ERROR ERRORSE14 0 0 0 ERROR ERRORSE15 0 0 91 ERROR ERRORSE16 0 81 45 ERROR ERRORSE17 0 81 0 ERROR ERRORSE18 0 81 91 ERROR ERRORSE19 71 40 45 ERROR ERRORSE20 71 40 0 ERROR ERRORSE21 71 40 91 ERROR ERRORSE22 71 0 45 ERROR ERRORSE23 71 0 0 ERROR ERRORSE24 71 0 91 ERROR ERRORSE25 71 81 45 ERROR ERRORSE26 71 81 0 ERROR ERRORSE27 71 81 91 ERROR ERROR

Test Case locks stocks barrels sales commissionWE1 35 40 45 3900 640WE2 0 0 0 ERROR ERRORWE3 71 81 91 ERROR ERROR

Weak Input Domain Equivalence Class Test Cases

Page 50: Boundary Value Analysis

50

Equivalence Class Test Cases for the Equivalence Class Test Cases for the Commission ProblemCommission Problem

sales = 45 x locks + 30 x stocks + 25 x barrelssales = 45 x locks + 30 x stocks + 25 x barrels L1 = { <lock, stock, barrel> : sales ≤ 1000 }L1 = { <lock, stock, barrel> : sales ≤ 1000 } L2 = { <lock, stock, barrel> : 1000 < sales ≤ L2 = { <lock, stock, barrel> : 1000 < sales ≤

1800 }1800 } L3 = { <lock, stock, barrel> : sales > 1800 }L3 = { <lock, stock, barrel> : sales > 1800 }

Output Range Equivalence Class Test Cases

Test Case locks stocks barrels sales commissionOR1 5 5 5 500 50OR2 15 15 15 1500 175OR3 25 25 25 2500 360

Page 51: Boundary Value Analysis

51

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 52: Boundary Value Analysis

52

Guidelines and ObservationsGuidelines and Observations

1.1. The traditional form of equivalence class testing is The traditional form of equivalence class testing is generally not as thorough as weak equivalence class generally not as thorough as weak equivalence class testing, which in turn, is not as thorough as the strong testing, which in turn, is not as thorough as the strong form of equivalence class testingform of equivalence class testing

2.2. The only time it makes sense to use the traditional The only time it makes sense to use the traditional approach is when the implementation language is not approach is when the implementation language is not strongly typedstrongly typed

3.3. If error conditions are a high priority, we could extend If error conditions are a high priority, we could extend strong equivalence class testing to include invalid strong equivalence class testing to include invalid classes (e.g. commission problem)classes (e.g. commission problem)

4.4. Equivalence class testing is appropriate when input Equivalence class testing is appropriate when input data is defined in terms of ranges and sets of discrete data is defined in terms of ranges and sets of discrete values. This is certainly the case when system values. This is certainly the case when system malfunctions can occur for out-of-limit variable valuesmalfunctions can occur for out-of-limit variable values

Page 53: Boundary Value Analysis

53

Guidelines and ObservationsGuidelines and Observations

5.5. Equivalence class testing is strengthened by a hybrid Equivalence class testing is strengthened by a hybrid approach with boundary value testing. (We can “reuse” approach with boundary value testing. (We can “reuse” the effort made in defining the equivalence classes) the effort made in defining the equivalence classes) (e.g. NextDate function)(e.g. NextDate function)

6.6. Equivalence class testing is indicated when the Equivalence class testing is indicated when the program function is complex. In such cases, the program function is complex. In such cases, the complexity of the function can help identify useful complexity of the function can help identify useful equivalence classes, as in the NextDate functionequivalence classes, as in the NextDate function

7.7. Strong equivalence class testing makes a presumption Strong equivalence class testing makes a presumption that the variables are independent when the Cartesian that the variables are independent when the Cartesian Product is taken. If there are any dependencies, these Product is taken. If there are any dependencies, these will often generate “error” test cases, as they did in the will often generate “error” test cases, as they did in the NextDate functionNextDate function

Page 54: Boundary Value Analysis

54

Guidelines and ObservationsGuidelines and Observations

8.8. Several tries may be needed before “the Several tries may be needed before “the right” equivalence relation is discovered, right” equivalence relation is discovered, as we saw in the NextDate example. In as we saw in the NextDate example. In other cases, there is an “obvious” or other cases, there is an “obvious” or “natural” equivalence partition. When in “natural” equivalence partition. When in doubt, the best bet is to try to second doubt, the best bet is to try to second guess aspects of any reasonable guess aspects of any reasonable implementationimplementation

Page 55: Boundary Value Analysis

55

AgendaAgenda Boundary Value TestingBoundary Value Testing

Boundary Value AnalysisBoundary Value Analysis Generalizing Boundary Value AnalysisGeneralizing Boundary Value Analysis Limitations of Boundary Value AnalysisLimitations of Boundary Value Analysis

Robustness TestingRobustness Testing Worst Case TestingWorst Case Testing Special Value TestingSpecial Value Testing ExamplesExamples

Test Cases for the Triangle ProblemTest Cases for the Triangle Problem Test Cases for the NextDate ProblemTest Cases for the NextDate Problem Test Cases for the Commission ProblemTest Cases for the Commission Problem

Guidelines for Boundary value TestingGuidelines for Boundary value Testing Equivalence Class TestingEquivalence Class Testing

Equivalence ClassesEquivalence Classes Weak Equivalence Class TestingWeak Equivalence Class Testing Strong Equivalence Class TestingStrong Equivalence Class Testing Traditional Equivalence Class TestingTraditional Equivalence Class Testing

Equivalence Class Test Cases for the Triangle ProblemEquivalence Class Test Cases for the Triangle Problem Equivalence Class Test Cases for the NextDate FunctionEquivalence Class Test Cases for the NextDate Function Equivalence Class Test Cases for the Commission ProblemEquivalence Class Test Cases for the Commission Problem Guidelines and ObservationsGuidelines and Observations

Page 56: Boundary Value Analysis

56

ReferencesReferences

Software Testing A Craftsman's Approach Software Testing A Craftsman's Approach 2nd edition, Paul C. Jorgensen, CRC 2nd edition, Paul C. Jorgensen, CRC Press (Chapters 5 and 6)Press (Chapters 5 and 6)