0% found this document useful (0 votes)
10 views

Lecture08_Blackbox Testing Techniques

The document discusses Equivalence Class Partitioning (ECP) and its application in software testing, emphasizing the technique's ability to reduce test cases by identifying input data partitions. It outlines the process of creating test cases based on representative values from these partitions and introduces concepts such as input domain analysis, boundary testing, and boundary value analysis (BVA). Various examples illustrate the principles of ECP and BVA, highlighting potential issues with input domain partitions and the importance of testing boundaries effectively.

Uploaded by

Ayesha Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Lecture08_Blackbox Testing Techniques

The document discusses Equivalence Class Partitioning (ECP) and its application in software testing, emphasizing the technique's ability to reduce test cases by identifying input data partitions. It outlines the process of creating test cases based on representative values from these partitions and introduces concepts such as input domain analysis, boundary testing, and boundary value analysis (BVA). Various examples illustrate the principles of ECP and BVA, highlighting potential issues with input domain partitions and the importance of testing boundaries effectively.

Uploaded by

Ayesha Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Software Quality Engineering

(SE3613)
Asma Rauf
[email protected]

SQE-SE3613 Asma Rauf 1


Equivalence Class Partitioning
• ECP is a software testing technique used to divide the
input data of a software application into partitions of
equivalent data from which test cases can be derived
• The idea is to reduce the number of test cases while still
effectively testing the software by selecting
representative values from each partition
• Process
• Identify input partitions
• Select representative values
• Create test cases
• Execute test cases
SQE – SE3613 2
Equivalence Class Partitioning
• Partition – a basic mathematical concept
• Set theory
• Subsets are mutually exclusive and collectively exhaustive

• Each of the subset in a partition is called an equivalent class


3
Equivalence Class Partitioning - Example
• Example
• Job age eligibility requirement is 18 to 35. Write test-cases to test this
application.

Invalid Partition Valid Invalid


< 18 18 - 35 >35

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

SE3613 Software Quality Engineering 21


Robustness Boundary Value Testing
• Another variant to BVA
• In robustness boundary value testing, we try to cross these
legitimate boundaries also
• i.e. {min–, min, min+, nom, max–, max, max+}
• For example, an application must be of age 18 to 30 in order
to apply for a job, then
• Robustness Testing (testcases) should be
17,18,19,24,29,30&31

SE3613 Software Quality Engineering 22


Example of BVA with 2 Variable
• Suppose we have 2 Variables x1 & x2 and their ranges are
• The range of x1: 10 to 90
• The range of x2: 20 to 70
• For x1, BVA is
• 10, 11, 50, 89 & 90 (4 x var + 1 (nominal))
• For x2, BVA is
• 20, 21, 45, 69, 70 (4 x var + 1(nominal))
• For both x1 & x2, to number of test-cases should be
•4x2+1=9

SE3613 Software Quality Engineering 23


Example of BVA & Robustness with 2 Variable

SE3613 Software Quality Engineering 24


Example of Robustness Testing with 2 Variable
• Suppose we have 2 Variables x1 & x2 and their ranges are
• The range of x1: 10 to 90
• The range of x2: 20 to 70
• For x1, Robustness Boundary Value Testing is
• 9, 10, 11, 50, 89 & 90, 91 (6 x var + 1 (nominal))
• For x2, Robustness Boundary Value is
• 19, 20, 21, 45, 69, 70, 71 (6 x var + 1(nominal))
• For both x1 & x2, to number of test-cases should be
• 6 x 2 + 1 = 13

SE3613 Software Quality Engineering 25


Example of Robustness Testing with 2 Variable
• For x1, Robustness Boundary Value Testing is
• 9, 10, 11, 50, 89 & 90, 91 (6 x var + 1 (nominal))
• For x2, Robustness Boundary Value is
• 19, 20, 21, 45, 69, 70, 71 (6 x var + 1(nominal))

• (9,45), (10,45), (11,45), (50,45), (89,45), (90,45), (91,45),


(50,19), (50,20), (50,21), (50,69), (50,70), (50,71)

SE3613 Software Quality Engineering 26


Activity
1. Assume a web application requires users to enter their age within the
range of 18 to 56 years. Calculate Boundary Value Analysis.
2. Consider an e-commerce platform where customers receive a discount
based on their purchase amount. The discount applies for amounts
between $100 and $600.
• Valid Boundaries: $100 (minimum), $600 (maximum)
• Invalid Boundaries: Below $100 and above $600. Calculate RBVA for the
above mentioned scenario.

3. Consider Two Variables


X1: 20-100
X2: 30-90
Calculate possible no of test case combinations by using RBVA.
SQE – SE3613 Ibrar Arshad 27
Worse-Case BVA
• Worst-Case boundary value analysis is a Black Box software
testing technique
• In Worst case boundary value testing, we make all
combinations of each value of one variable with each value
of another variable
• For 1 var, total test-cases will be 5 (min, min+, nom, max- &max+)
• For 2 vars, test-cases will be 52, so for n variables, the total test-cases
will be 5n

SE3613 Software Quality Engineering 28


Example of Worse Case BVA (2 Variables)
• Suppose we have 2 Variables x1 & x2 and their ranges are
• The range of x1: 10 to 90
• The range of x2: 20 to 70

SE3613 Software Quality Engineering 29


Boundary Testing - Application
• Primary application domain of boundary testing is the problems related
to input domain partitioning into sub-domains
• Various other situations involving boundaries can also benefit from this
idea. For example:
• Capacity Testing
• An application that allows 100 student registration for one course.
Check how it responds to 101th student
• Queuing Testing
• Lower bound of the queue and upper bound of the queue.
• Upper and lower bounds in array implementation

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

1. What are the valid and invalid partition classes?


2. Derive the test cases for the partitions and boundaries
3. Identify the problem(s), if any, in the requirements provided in the
scenario

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.

SQE – SE3613 Ibrar Arshad 33

You might also like