Lecture08_Blackbox Testing Techniques
Lecture08_Blackbox Testing Techniques
(SE3613)
Asma Rauf
[email protected]
TC 1: Age = 13
TC 2: Age = 40
TC 3: Age = 25
SQE – SE3613 4
Equivalence Class Partitioning - Example
• Grade is calculated based on following formula.
SQE – SE3613 5
Equivalence Class Partitioning - Example
• Suppose you have a bank account that offers variable
interest rates: 0.5 per cent for the first £1,000 credit; 1 per
cent for the next £1,000; 1.5 per cent for the rest. If you
wanted to check that the bank was handling your account
correctly what valid input partitions might you use?
SQE – SE3613 6
Equivalence Class Partitioning - Example
• Valid password should be at least 8 characters long, must
contains at least 1 Uppercase alphabet, 1 number and 1
special character. What are valid and invalid partitions for a
valid password.
SQE – SE3613 7
Input Domain Analysis/Partitioning/Boundary Testing
• Basic concepts
• Let x1,…, xn denote input variables to a program
• The input space is an n-dimensional space represented by a
vector X, also called input vector, X =[x1,…, xn ]
• When the input vector X takes a specific value, we call it a test
point or a test case
• The input domain consists of all the points representing all
the allowable input combinations specified for the program in
the product specification
8
Input Domain Analysis/Partitioning/Boundary Testing
• Basic concepts
• An input sub-domain is a subset of the input domain;
• a sub-domain is sometimes defined by a set of inequalities like f(x1,…, xn ) < K,
where K is an integer
• < could be replaced by >, =, =>, =< etc
• A domain partition, is a partition of the input domain into a number
of sub-domains
• That is, these sub-domains are mutually exclusive, and collectively exhaustive
• A boundary is where two sub-domains meet;
• For instance, with the above inequality, a boundary would be f(x1,…, xn ) =K
9
Input Domain Analysis/Partitioning/Boundary Testing
• Basic concepts
• Boundary point: A point on the boundary
• A boundary is said to be closed if the points on the boundary are
included in the domain of interest
• A boundary is said to be open if the points on the boundary do not
belong to the domain of interest
• A point belonging to a sub-domain but not on the boundary is called
an interior point
• The opposite is an exterior, i.e. not belonging to a sub-domain and not
on its boundary
10
Input Domain Testing Steps
• The general idea of domain testing:
• Trying to achieve domain coverage
• Steps:
• Identify the input variable, input space, and define the input domain
• Divide or classify the input domain into sub-domains to form a partition
• Perform domain analysis for each sub-domain to examine its limits in each
dimension and its boundary properties, like the boundary definition and
closure properties
• Select test points to cover these partitioned sub-domains based on domain
analysis results from the previous step
• Test with the above selected test points as input
11
Input Domain Testing Steps
• Simplest strategy:
• The simplest strategy is to sample one test point from inside each
sub-domain, thus achieving complete coverage of all the sub-
domains
• However, there is empirical evidence that problems with input
domain partitions mostly occur at the sub-domain boundaries
• Therefore some specialized testing techniques are called for, as we
will see in the rest of this lecture
12
General Problems With Input Domain Partitions
• Ambiguity or under-defined processing for some given
inputs
• Some test points are under-defined
• Explanation: when computational procedures are defined for
individual sub-domains, but these sub-domains do not cover
the complete input domain
• Referred to as having “holes” in the input domain
• Mostly occur at sub-domain boundaries
13
General Problems With Input Domain Partitions
Example
Consider another scenario involving a software application that
processes user ages. The application might define different
functionalities based on age groups:
Children: Age < 13
• Teenagers: Age 13 to 19
• Adults: Age ≥ 20
If a user inputs an age of 13, it falls on the boundary between
"Children" and "Teenagers." If the application does not explicitly
define what happens at age 13 (e.g., whether they receive
benefits for children or teenagers), it results in an under-defined
state. This ambiguity could lead to errors or unexpected
behavior in the application.
14
General Problems With Input Domain Partitions
• Contradiction or over-defined processing for some given input
• Some input values or test points have contradictory computation
associated with them, or are over-defined
• Result in different output for the same input, or the system behaves
incorrectly
• Some sub-domains overlap
• Again, a boundary problem
• Both the above problems mostly happen at boundaries
• Rules for Grades:
• 90≤score≤100: Grade A
• 80≤score≤90: Grade B
• 70≤score≤80: Grade C
15
Finer Description of Boundary Problems
• Closure problem:
• A closure error occurs if a boundary is open when
the intention is to have a closed boundary, or vice
versa
• e.g., an intended open boundary is specified or
implemented as a closed one.
• The relational operator ≥ is implemented as =
• The relational operator = is implemented as ≤
16
Finer Description of Boundary Problems
• Boundary shift:
• This happens when the constant term of the inequality defining the
boundary takes up a value different from the intended value
• In concrete terms, a shifted-boundary error occurs due to a change in
the magnitude or the sign of the constant term of the inequality
• e.g. consider the boundary defined by the following predicate P1: x +
5y> 5
• If the programmer’s intention was to define a boundary represented
by the p: x + 5y> 4
• Other boundary changes are possible too; e.g boundary tilt where
some parameters in equation are changed slightly x + 55y>4
17
Finer Description of Boundary Problems
• Missing boundary:
• means that two neighboring sub-domains will collapse into
one sub-domain, and therefore all points in them would be
treated similarly
18
Finer Description of Boundary Problems
• Missing boundary:
• Scenario:
• A grading system is meant to assign grades based on scores:
• 0–49: Fail
• 50–100: Pass
• Intended Rule:
• Fail if score≤49
• Pass if score≥50
• Implementation Mistake:
• The programmer forgets to add the boundary between 49 and 50. Instead, they implement the
rule as:
• Fail if score<50
• Pass if score>49
• Here, scores like 49.5 fall into both categories, and the system cannot distinguish them properly.
• Impact:
• The boundary disappears, and the system might incorrectly assign the same grade to both Fail
and Pass scores 19
Finer Description of Boundary Problems
• It is not difficult to notice that input data points fall in the
wrong domain if there is a closure defect, a shifted boundary, or
a tilted boundary
• Assuming that adjacent domains perform different
computations,
• a program will produce a wrong outcome because of wrong
computations performed on those input data points which fall in the
wrong domains
• To deal with such problems, various specific domain testing
strategies can be used
• to focus on testing related to the sub-domain boundaries, resulting in
the so-called boundary testing strategies
20
Boundary Value Analysis
• The basic idea of BVA is to use input variable values at their
minimum, just above the minimum, a nominal value, just
below their maximum, and at their maximum.
• That is, {min, min+, nom, max–, max}
• For example, an application must be of age 18 to 30 in order
to apply for a job, then
Inputs for BVA should be 18, 19, 24, 29 & 30
30
Exercise Partitioning & BVA
• Example 1:
A mail-order company selling flower seeds charges £3.95 for
postage and packing on all orders up to £20 value and £4.95 for orders
above £20 value and up to £40 value. For orders above £40 value there
is no charge for postage and packing. If you were using equivalence
partitioning to prepare test cases for the postage and packing charges
• what valid partitions would you define?
• What about non-valid partitions?
SQE-SE3613 31
Exercise Partitioning & BVA
• Example 2:
• If you take the train before 9:30 am or in the afternoon after 4:00
pm until 7:30 pm (the rush hour), you must pay full fare. A saver
ticket is available for trains between 9:30 am and 4:00 pm, and
after 7:30 pm
SQE-SE3613 32
Activity
You are tasked with testing a software component that accepts
three input variables: X, Y, and Z. The valid ranges for these
variables are defined as follows:
Variable X: 0 to 100
Variable Y: 20 to 60
Variable Z: 80 to 100
Using Boundary Value Analysis, identify the valid and invalid
partition classes for these variables. Then, derive the test cases
based on the boundaries of these partitions.
1. Define the valid and invalid partition classes for each variable.
2. List all the test cases you would create using BVA.