Boundary Value Testing - York University · Input domain testing is the most commonly taught (and...

38
Boundary Value Testing Chapter 5

Transcript of Boundary Value Testing - York University · Input domain testing is the most commonly taught (and...

Page 1: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

Boundary Value Testing

Chapter 5

Page 2: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–2

Introduction

Input domain testing is the most commonly taught (andperhaps the most commonly used) software testingtechnique

There are a number of approaches to boundary valueanalysis

We will study some of the limitations of domain testing

Page 3: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–3

Program view for boundary analysis

What is the view we take of a program for boundaryanalysis?

Page 4: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–4

Program view for boundary analysis – 2

Many programs can be viewed as a function F thatmaps values from a set A (its domain) to values inanother set B (its range)

The input variables of F will have some (possiblyunstated) boundaries:

!

F(x1,x2) : A"B

!

a " x1 " b

!

c " x 2 " d

Page 5: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–5

What is BVA?

What is boundary analysis?

Page 6: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–6

What is BVA – 2

For each variable, select five values Min The minimum

Min+ Slightly above the minimum

Nom Nominal

Max– Slightly below the maximum

Max Maximum

Page 7: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–7

Rational for BVA

What is the rationale for BVA?

Page 8: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–8

Rational for BVA – 2

What is the rationale for BVA? Errors occur at boundaries because people

Mistake logical relations such as mixing < with ≤

Are off by one in counting Fence posts and rails

Page 9: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–9

Critical assumption

What is the critical assumption made with boundaryvalue testing?

Page 10: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–10

Critical assumption

What is the critical assumption made with boundaryvalue testing?

Single Fault Assumption Failures are rarely the result of the simultaneous

occurrence of two (or more) faults

Page 11: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–11

Single fault assumption

Based on this assumption How are test cases selected when multiple

variables are involved?

Page 12: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–12

Single fault assumption – 2

Generate test cases as such for all i Values of all but one variable xi at nominal

xi assumes the four non-nominal values from the slideBoundary Analysis – 2

One test case with all nominal values

What are the number of test cases?

See Figure 5.2

Page 13: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–13

Single fault assumption – 3

Generate test cases as such for all i Values of all but one variable xi at nominal

xi assumes the four non-nominal values from the slideBoundary Analysis – 2

One test case with all nominal values

What are the number of test cases? #Variables * 4 + 1

See Figure 5.2

Page 14: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–14

Two-variable function test cases

<x1nom, x2min><x1nom, x2min+><x1nom, x2nom><x1nom, x2max-><x1nom, x2max>

<x1min, x2nom><x1min+, x2nom><x1nom, x2nom><x1max-, x2nom><x1max, x2nom>

Apply BVA to the Triangle problem

1 ≤ a ≤ 2001 ≤ b ≤ 2001 ≤ c ≤ 200

Redundant tests

Page 15: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–15

Advantages

When does boundary value analysis work well?

Page 16: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–16

Advantages – 2

Independent variables Single fault assumption

Physical quantities

Languages that are not strongly typed Why were strongly typed languages developed?

Page 17: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–17

Advantages – 3

Independent variables Single fault assumption

Physical quantities

Languages that are not strongly typed Why were strongly typed languages developed?

To prevent errors easily found with BVA

Page 18: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–18

Limitations

What are the limitations of boundary value analysis?

Page 19: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–19

Limitations – 2

Does not work well for Boolean variables Why are these not suitable?

Does not work well for logical variables PIN, transaction type

Why are these not suitable?

When variables are not independent – i.e. aredependent What example does the textbook give?

Not that useful for strongly-typed languages

Page 20: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–20

Variations of boundary value analysis

What extensions or variations are made forboundary value analysis?

What is the justification for each?

Page 21: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–21

Extensions

Robustness testing

Worst case testing

Robust worst case testing

Special value testing

Random testing

Page 22: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

Robustness testing

What is robustness testing?

BVT–22

Page 23: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–23

Robustness testing – 2

Add two more values per variable Max+ Slightly greater than the maximum Min– Slightly less than the minimum

What is the expected output? Hopefully error message, system recovers

Implementing these test cases may not be possible What is the difficulty?

See Figure 5.3

Page 24: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–24

Robustness testing – 3

Add two more values per variable Max+ Slightly greater than the maximum Min– Slightly less than the minimum

What is the expected output? Hopefully error message, system recovers

Implementing these test cases may not be possible What is the difficulty?

Determining the expected output for out of rangevalues

See Figure 5.3

Page 25: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–25

Robustness testing – 4

What are the number of test cases?

When is robust testing mandated?

Page 26: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–26

Robustness testing – 5

What are the number of test cases? #variables * 6 + 1

When is robust testing mandated? With exception handling

Page 27: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

Worst case testing

What is worst case testing?

BVT–27

Page 28: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–28

Worst-Case Testing – 2

Rejects the simple fault assumption and tests allcombinations of values

Often leads to a large number of test cases with lowbug-finding power Why?

What are the number of test cases?

See Figure 5.4

Page 29: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–29

Worst-Case Testing – 3

Rejects the simple fault assumption and tests allcombinations of values

Often leads to a large number of test cases with lowbug-finding power Why?

Typically there are few bugs compared to the numberof tests

What are the number of test cases? 5 ^ #variables

See Figure 5.4

Page 30: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–30

Worst-Case Testing – 4

What type of testing is better to do in place of worstcase testing?

Page 31: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–31

Worst-Case Testing – 5

What type of testing is better to do in place of worstcase testing? Often better to use Special Value Testing

Page 32: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

Robust worst case testing

What is robust worst case testing?

BVT–32

Page 33: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–33

Robust worst case testing – 2

Add the values min– and max+ to the possible variablevalues

Now take all combinations of variable values

What are the number of test cases?

See Figure 5.5

Page 34: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

Special value testing

What is special value testing?

BVT–34

Page 35: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–35

Special value testing – 2

Use best engineering judgment Intuition

Domain knowledge

Experience

Soft spots

Page 36: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–36

In class activity

Do exercises 1, 2 and 3

Page 37: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–37

Random testing

Select random values for each variable

How many tests do we make?

Page 38: Boundary Value Testing - York University · Input domain testing is the most commonly taught (and perhaps the most commonly used) software testing technique There are a number of

BVT–38

Random testing – 2

Select random values for each variable

How many tests do we make? Related to the probability of producing every outcome at

least once

Related to the probability of executing every statement /path at least once