Title: Testing Input Fields with Boundary Value Technique
1Testing Input Fields with Boundary Value
Technique
2Boundary Value Testing
- A type of Black box functional testing
- The program takes inputs and maps some out-puts
- The internal of the program itself is not
considered - A technique to generate test cases via
considering (mostly) the inputs to the program - The rationale for this focus is that there are
experiences from the past which indicate that
errors tend occur at the extreme points. - Input data (legal versus illegal)
- Loop iteration (beginning and ending of loops)
- Output fields (legal versus illegal)
3A simple example
- Consider a program that reads the age of each
person here and computes the average age of the
people. - input (s) ? Program ? output average age
- How would you test this?
- How many test cases would you generate?
- What type of test data would you input to test
this program?
4Input (s) to Program Average
- First question would be - - - how many input
data? - The answer is some number 1 or more --- not too
sure, yet. - Second question would be --- what value should
each input age be? - Try some typical age such as 23 or 45
- Try some atypical age 125 or 700
- How about trying a wrong age of -5 or 0 or _at_
- When we try the atypical age or some wrong age,
we may discover that the program may not handle
or process properly ---- possibly resulting in a
failure. Failure in this case, may include
strange answer, but not necessarily program
termination.
5Example Program Age Average
- Inputs composed of only typical ages 23, 67, 97
- Look at the output average, and the average is
computed either - Correctly
- Incorrectly
- Inputs composed of atypical or wrong ages
- What is an atypical or wrong age?
- Let us cap the age from 1 to 150.
- So the lower and upper boundaries for age is 1
and 150, respectively.
6Boundaries of the inputs
1 lt age lt 150
150
age
1
The basic boundary value testing would include
5 situations 1. - at minimum
boundary 2. - immediately above minimum
3. - between minimum and maximum (nominal)
4. - immediately below maximum 5. - at
maximum boundary
7The Test Cases for this Example
- Howe many test cases for this example ?
- answer for this one field 5
- What types of test input values?
- 1 at the minimum
- 2 at one above minimum
- 45 at middle
- 149 at one below maximum
- 150 at maximum
8Single fault or independent faults
- For the previous problem, there was 1 input
field. Suppose there are 2 distinct inputs that
are assumed to be independent (single fault) of
each other. - Input field 1 years of education ( say 1 to 23
) - Input field 2 age
- If they are independent of each other, then we
can start with looking at 5 5 10 sets, but
wont need all 10 of them.
- coverage of input data yrs of ed
- 1. n 1 age whatever(37)
- n 2 age whatever
- 3. n 12 age whatever
- n 22 age whatever
- n 23 age whatever
- coverage of input data age
- 1. n 12 age 1
- n 12 age 2
- 3. n 12 age 37
- n 12 age 149
- n 12 age 150
92 independent inputs
age
yrs of ed.
- Note that there needs to be only 9 test cases
for 2 independent variables or inputs. - In
general, there will be (4z 1) test cases for z
independent inputs.
10Some Limitations of Boundary Value Testing
- What would we do with boolean variables?
- True
- False
- (these may not be input fields but radio buttons)
- What about non-numerical variable where the
values may be text?
11Robustness testing
- This is just an extension of the Boundary Values
to include - Less than minimum
- Greater than maximum
- There are 7 cases or values to worry about for
each independent variable input. - The testing of robustness is really a test of
error handling. - Do we anticipate the error situations?
- Do we issue informative error messages?
- Do we allow some kind of recovery from the error?
Levels of Problem Severity?
122 independent inputs for robustness test
X
Y
- Note that there needs to be only 13 test cases
for 2 independent variables or inputs. - In
general, there will be (6n 1) test cases for n
independent inputs.
13More on Robustness Testing
- Perhaps a little more than 7 test cases?
- beyond the boundary cases should include other
illegal inputs - For numeric field should we try some non-numeric
input? - How about blank or no input?
- So perhaps we ought to consider 8 or 9 as a more
reasonable number of test cases when we consider
all types of outside the boundary cases for
Robustness Testing
14Worst-Case testing for non-independent variables
- If the input variables are not independent, then
we would need to test all possible combinations
of values that the variable may take on. - For Boundary Value Testing, each of the 5
possible values of a variable must iterate
through the 5 possible values of the other
variable(s). - Thus for n input variables, there are 5n possible
test cases - For Robustness Testing, each of the 7 possible
values of a variable must iterate through the 7
possible values of the other variable(s). - Thus for n input variables, there are 7n possible
test cases
152 non-independent inputs for worst case test
X
For 2 non-independent variables, there are 52
25 test cases
Y
- In general, there will be 5n test cases for n
non-independent inputs.
16Hierarchy
- For n number of variables (input fields)
- Boundary Value testing of n inputs 4n 1
- Robustness testing of n inputs 6n 1
- Worst case for boundary value 5n
- Worst case for robustness 7n
- Boundary Value is a subset of Robustness
- Worst case for boundary value is a subset of
worst case of robustness
17Some Special Value and Random Testing
- Special Value Testing
- Based on experience
- Based on special knowledge of the industry
- Ad hoc in nature
- Has had some very valuable inputs
- Costly to find the industry experts
- Random Value Testing
- Based on some random number generator
- Generate values within bounds of the boundary or
worst case - The value of random test has not been clearly
justified except we may be able to automate this
Especially for multiple dependent and legitimate
test cases