Boundary Value Testing Technique Training

Содержание

Слайд 2

Agenda Introduction Technique Examples Applicability and Limitations Summary Practice References

Agenda

Introduction
Technique
Examples
Applicability and Limitations
Summary
Practice
References

Слайд 3

Слайд 4

Introduction Equivalence class testing is the most basic test design technique.

Introduction

Equivalence class testing is the most basic test design technique. It

helps testers choose a small subset of possible test cases while maintaining reasonable coverage.
Equivalence class testing has a second benefit. It leads us to the idea of boundary value testing, the second key test design technique to be presented.
Слайд 5

Introduction What is boundary value testing? Why do we need it?

Introduction

What is boundary value testing? Why do we need it?

Boundary value testing

focuses on the boundaries simply because that is where so many defects hide.
Слайд 6

Introduction: Situation 1 We are writing a module for a human

Introduction: Situation 1

We are writing a module for a human resources

system that decides how we should process employment applications based on a person's age. Our organization's rules are:
0-16 – Don't hire
16-18 – Can hire on a part-time basis only
18-55 – Can hire as a full-time employee
55-99 – Don't hire
Слайд 7

Introduction: Edge Notice the problem at the boundaries – the "edges"

Introduction: Edge

Notice the problem at the boundaries – the "edges" of

each class. The age "16" is included in two different equivalence classes (as are 18 and 55).
The first rule says don't hire a 16-year-old. The second rule says a 16-year-old can be hired on a part-time basis.
Слайд 8

Introduction: Solution 1 If (applicantAge >= 0 && applicantAge hireStatus="NO"; If

Introduction: Solution 1

If (applicantAge >= 0 && applicantAge <=16)
hireStatus="NO";
If

(applicantAge >= 16 && applicantAge <=18)
hireStatus="PART";
If (applicantAge >= 18 && applicantAge <=55)
hireStatus="FULL";
If (applicantAge >= 55 && applicantAge <=99)
hireStatus="NO";

Of course, the mistake that programmers make is coding inequality tests improperly.
Writing > (greater than) instead of ≥ (greater than or equal) is an example.
The interesting values on or near the boundaries in this example are:
{-1, 0, 1}, {15, 16, 17}, {17, 18, 19}, {54, 55, 56}, and {98, 99, 100}.

Слайд 9

Introduction: Inspection The most efficient way of finding such defects, either

Introduction: Inspection

The most efficient way of finding such defects, either in

the requirements or the code, is through inspection.
However, no matter how effective our inspections, we will want to test the code to verify its correctness.
Слайд 10

Introduction: Situation 2 Perhaps this is what our organization meant: 0-15

Introduction: Situation 2

Perhaps this is what our organization meant:
0-15 – Don't

hire
16-17 – Can hire on a part-time basis only
18-54 – Can hire as a full-time employee
55-99 – Don't hire

What about ages -3 and 101? Note that the requirements do not specify how these values should be treated. We could guess but "guessing the requirements" is not an acceptable practice.

Слайд 11

Introduction: Solution 2 The code that implements the corrected rules is:

Introduction: Solution 2

The code that implements the corrected rules is:
If (applicantAge

>= 0 && applicantAge <=15)
hireStatus="NO";
If (applicantAge >= 16 && applicantAge <=17)
hireStatus="PART";
If (applicantAge >= 18 && applicantAge <=54)
hireStatus="FULL";
If (applicantAge >= 55 && applicantAge <=99)
hireStatus="NO";

The interesting values on or near the boundaries in this example are:
{-1, 0, 1}, {14, 15, 16}, {15, 16, 17}, {17, 18, 19}, {53, 54, 55}, {54, 55, 56}, and {98, 99, 100}. Other values, such as {-42, 1001, FRED, %$#@} might be included depending on the module's documented preconditions.
Boundary values: -1, 0, 15, 16, 17, 18, 54, 55, 99, 100.

Слайд 12

Technique

Technique

Слайд 13

Technique: Steps Identify the equivalence classes. Identify the boundaries of each

Technique: Steps

Identify the equivalence classes.
Identify the boundaries of each equivalence

class.
Create test cases for each boundary value by choosing one point on the boundary, one point just below the boundary, and one point just above the boundary.
Слайд 14

Technique: Examples "Below" and "above" are relative terms and depend on

Technique: Examples

"Below" and "above" are relative terms and depend on the

data value's units.
If the boundary is 16 and the unit is "integer"
then the "below" point is 15 and the "above" point is 17.
Слайд 15

Technique: Examples If the boundary is $5.00 and the unit is

Technique: Examples

If the boundary is $5.00 and the unit is "US

dollars and cents"
then the below point is $4.99 and the above point is $5.01.
On the other hand, if the value is $5 and the unit is "US dollars"
then the below point is $4 and the above point is $6.
What if user can enter anything in the field as there’s no UI limitation? How will we define boundary values?
$4,(9); 5 and 5,(0)1
Слайд 16

Technique: Examples Which boundary values will we use if we test

Technique: Examples

Which boundary values will we use if we test casino,

coffee machine or Fibonacci numbers system?
Слайд 17

Technique: Examples Why do we need to test one value above

Technique: Examples

Why do we need to test one value above and

one value below the boundary?
x>=2
Test: 1, 2 – everything is OK
x>2
Test: 1, 2 – you will find a defect. But do you now why it happens? Which test you will do next? 10, 999, 5 or 3?
x=2
Test: 1, 2 – gives the same result but you won’t find a defect, but 1, 2, 3 will gain confidence and find a defect
Слайд 18

Technique: Tips Note that a point just above one boundary may

Technique: Tips

Note that a point just above one boundary may be

in another equivalence class. There is no reason to duplicate the test. The same may be true of the point just below the boundary.

You could, of course, create additional test cases farther from the boundaries (within equivalence classes) if you have the resources. These additional test cases may make you feel warm and fuzzy, but they rarely discover additional defects.

Слайд 19

Technique: Continuous Boundary values for a continuous range of inputs. Test

Technique: Continuous

Boundary values for a continuous range of inputs.
Test data input

of {$999, $1,000, $1,001} on the low end and {$83,332, $83,333, $83,334} on the high end.
Слайд 20

Technique: Discrete Boundary values for a discrete range of inputs. Test

Technique: Discrete

Boundary values for a discrete range of inputs.
Test data input

of {0, 1, 2} on the low end and {4, 5, 6} on the high end.
Слайд 21

Technique: Fractional What are boundary values here if we may have

Technique: Fractional

What are boundary values here if we may have fractional

numbers? Do we have points below and above the boundary?
Test data input of {0,(9); 1; 1,(0)1} on the low end and {4,(9); 5; 5,(0)1} on the high end. But no exact points.
Слайд 22

Technique: Fractional We need to have here several solutions what to

Technique: Fractional

We need to have here several solutions what to do

in such cases:
Use only edge value for testing, don’t use above\below edge values
Get UI requirements\limitations for this field – 4.99 is closest to 5 from UI point of view
Get business requirements\limitations for this field
Find out closest above\below values to the identified edge
Слайд 23

Technique: Array What are boundary values here? No boundaries.

Technique: Array

What are boundary values here?
No boundaries.

Слайд 24

Technique: Combination Rarely we will have the time to create individual

Technique: Combination

Rarely we will have the time to create individual tests

for every boundary value of every input value that enters our system. More often, we will create test cases that test a number of input fields simultaneously.
A set of test cases containing combinations of valid (on the boundary) values and invalid (off the boundary) points.
Слайд 25

Technique: Combination

Technique: Combination

Слайд 26

Technique: Usage Why do we need values above and below edge?

Technique: Usage

Why do we need values above and below edge?
Higher test

coverage
ECP replacement
Time & Budget constraints
Quicker defect location identification
High quality requirements for the project from Customer\Domain
Why don’t we need\want to use below\above edge values?
Time & Budget constraints
Less probability to discover defects
Good enough test coverage for project
Слайд 27

Examples

Examples

Слайд 28

Examples: 1 Input to this field can be between one and

Examples: 1

Input to this field can be between one and four

numeric characters (0, 1, ..., 8, 9).

A set of boundary value test cases for the length attribute would be {0, 1, 4, 5} numeric characters.

Слайд 29

Examples: 2 34,4; 34,5; 42; 42,1 A thermometer can have values

Examples: 2

34,4; 34,5; 42; 42,1

A thermometer can have values between 34,5

and 42.

34,4(9); 34,5; 42; 42,(0)1

Слайд 30

Applicability and Limitations

Applicability and Limitations

Слайд 31

Applicability and Limitations Boundary value testing can significantly reduce the number

Applicability and Limitations

Boundary value testing can significantly reduce the number of

test cases that must be created and executed. It is most suited to systems in which much of the input data takes on values within ranges or within sets.
Boundary value testing is equally applicable at the unit, integration, system, and acceptance test levels. All it requires are inputs that can be partitioned and boundaries that can be identified based on the system's requirements.
Слайд 32

Summary

Summary

Слайд 33

Summary While equivalence class testing is useful, its greatest contribution is

Summary

While equivalence class testing is useful, its greatest contribution is to

lead us to boundary value testing.
Boundary value testing is a technique used to reduce the number of test cases to a manageable size while still maintaining reasonable coverage.
Boundary value testing focuses on the boundaries because that is where so many defects hide. Experienced testers have encountered this situation many times. Inexperienced testers may have an intuitive feel that mistakes will occur most often at the boundaries.
Create test cases for each boundary value by choosing one point on the boundary, one point just below the boundary, and one point just above the boundary. "Below" and "above" are relative terms and depend on the data value's units.
Слайд 34

Practice

Practice

Слайд 35

Practice ZIP Code – five numeric digits. Legitimate ZIP Codes in

Practice

ZIP Code – five numeric digits. Legitimate ZIP Codes in the

United States.
Last Name – one through fifteen characters (including alphabetic characters, periods, hyphens, apostrophes, spaces, and numbers).
User ID – eight characters at least two of which are not alphabetic (numeric, special).
Course ID – three alpha characters representing the department followed by a six-digit integer which is the unique course identification number. The possible departments are:

PHY - Physics
EGR - Engineering
ENG - English
LAN - Foreign languages
CHM - Chemistry
MAT - Mathematics
PED - Physical education
SOC - Sociology

Слайд 36

Practice: Answers 1 ZIP Code – five numeric digits. Legitimate ZIP

Practice: Answers 1

ZIP Code – five numeric digits. Legitimate ZIP Codes

in the United States.

Length
4, 5, 6

Legitimate
01000, 01001, 99929, 99930
http://www.city-data.com/zipDir.html

Слайд 37

Practice: Answers 2 Last Name – one through fifteen characters (including

Practice: Answers 2

Last Name – one through fifteen characters (including alphabetic

characters, periods, hyphens, apostrophes, spaces, and numbers).

Length
0, 1, 15, 16

Слайд 38

Practice: Answers 3 User ID – eight characters at least two

Practice: Answers 3

User ID – eight characters at least two of

which are not alphabetic (numeric, special).

Length
7, 8, 9

Number of numeric and special characters
1, 2, 8, 9

Слайд 39

Practice: Answers 4 Course ID – three alpha characters representing the

Practice: Answers 4

Course ID – three alpha characters representing the department

followed by a six-digit integer which is the unique course identification number. The possible departments are:

Length Alpha
2, 3, 4

Characters position
first 3, 2d and 3d and 4th

Length Digit
5, 6, 7

Length General
8, 9, 10

PHY - Physics
EGR - Engineering
ENG - English
LAN - Foreign languages
CHM - Chemistry
MAT - Mathematics
PED - Physical education
SOC - Sociology

Слайд 40

Practice: Answers 5

Practice: Answers 5

Слайд 41

References

References

Слайд 42