Professional Documents
Culture Documents
MES3053 - Chap5 Blackbox Testing
MES3053 - Chap5 Blackbox Testing
MES3053 - Chap5 Blackbox Testing
2
Introduction
Black-box approach view software as black-
box, i.e., without any knowledge of internal
structure of software under test (SUT)
Tester concentrate on software behavior and
its functionality.
Input Output
Black-box Testing Concept
Also known as functional testing or specification-based
testing.
No knowledge on the internal structure of the SUT are
required.
This approach only depends on the legal inputs and
what are the expected outputs.
Consequently, the tester and the programmer can be
independent of one another.
Advantage: Avoid programmers biasness toward his own work.
Black-box Testing Concept ..cont.
It can be performed at any testing level.
It occurs from the viewpoint of an end user.
It requires a set of input/output relationships
that verify whether each specification
requirement is implemented correctly.
At least one test case should represent each
entry of the specification requirement
document.
These test cases should test the various
boundary conditions for each entry.
The Basis of Black-box Testing
BBT is totally based on the testing for requirements and
functionality of the work products.
The objectives of BBT is to uncover the following type
of errors:
Incorrect of missing functions
Interface errors
Errors in data structures or external database access
Performance errors
Initialization and termination errors
The Basis of Black-box Testing ..cont.
14
Equivalence Class
An equivalence class is a set of inputs that the program
treats identically when the program is tested.
An equivalence class is used to represent certain
condition on the input domain.
Input conditions are typically used to partition the input
domain into equivalence classes for the purpose of
selecting inputs.
During equivalence partitioning process, both valid (i.e.
return a non-error value) and invalid (i.e. return an
erroneous value) inputs are considered.
15
General View of Equivalence Partitioning
Invalid inputs
Valid inputs
system
outputs
16
Test Case Generation
A set of guidelines for generating test cases
using equivalence partitioning technique.
The guidelines is based on the input
conditions such as:
If an input condition specifies a range,
If an input condition requires a specific value
If an input condition specifies a member of a set
If an input condition is Boolean
Test Case Generation ..cont.
If an input condition specifies a range of
values then identify:
One valid equivalence class
Two invalid equivalence class
Example: If a range of values 199, thus three
equivalence classes are derived.
One valid equivalence class: {1,2, ..99}
Two invalid equivalence classes
{x | x < 1}
{x | x > 99 }
Test Case Generation ..cont.
If an input condition specifies a specific value
then identify:
One valid equivalence class
Two invalid equivalence class
Example: If the specific value is 4055, thus
three equivalence classes are derived.
One valid equivalence class: 4055
Two invalid equivalence classes
{x | x < 4055}
{x | x > 4055}
Test Case Generation ..cont.
If an input condition specifies a set of values
then identify:
One valid equivalence class
One invalid equivalence class
Example: If a set of values is M = {a, y, n, z}
thus two equivalence classes are derived.
One valid equivalence class {x | x M }
One invalid equivalence classes
{x | x M }
Test Case Generation ..cont.
If an input condition specifies Boolean value
then identify:
One valid equivalence class
One invalid equivalence class
Exercise 1
Define the equivalence classes for a program
specification states that the program accepts 4 to
10 inputs and each input represents five digit
integers greater than 10000.
22
Solution:
Less than 10001 Between 10001 and 99999 More than 99999
TC 1
TC 2
TC 3
TC 4
TC 5
TC 6
TC 7
TC 8
TC 9
Exercise 2
A store in city offers different discounts depending
on the purchases made by the individual. In order to
test the software that calculates the discounts, we
can identify the ranges of purchase values that earn
the different discounts. For example, if a purchase is
in the range of $1 up to $50 has no discounts, a
purchase over $50 and up to $200 has a 5% discount,
and purchases of $201 and up to $500 have a 10%
discounts, and purchases of $501 and above have a
15% discounts.
Solution:
Valid
Invalid Valid Valid Valid
Partition(No
Partition Partition(5%) Partition(10%) Partition(15%)
Discounts)
$0.01 $1-$50 $51-$200 $201-$500 $501-Above
Exercise 3
Consider a module that is intended to accept a grocery list
with the following specification. The grocery module requires
a user to key-in two types of input which are item-type and
item-name.
The input for item-type is three digit integer values that are between
100 and 999
The item-name, on the other hand is to be characters values and the
length of the characters values is between 5 and 15 characters.
If the user enters valid item-type and item-name, the module will
display the price of the item; otherwise invalid item will be
displayed.
Boundary Value Analysis (BVA)
It complements equivalence partitioning
Rather than focusing solely on input
conditions, BVA derives test cases from the
output domain as well
Boundary value analysis (BVA) requires selection of
test cases that exercise bounding values
Boundary Value Analysis (BVA)
We can identify 4 valid equivalence partitions and 1 invalid partition as shown below.
Valid
Valid Valid Valid
Invalid Partition Partition(No
Partition(5%) Partition(10%) Partition(15%)
Discounts)
$0.01 $1-$50 $51-$200 $201-$500 $501-Above
Solution
Boundary values for Invalid partition: 0.00
Boundary values for valid partition(No Discounts): 1,
50
Boundary values for valid partition(5% Discount): 51,
200
Boundary values for valid partition(10% Discount):
201,500
Boundary values for valid partition(15% Discount):
501, Max allowed number in the software
application
54
Decision Tables
Represent very complex processes with
multiple decision rules
Decision table: a matrix representation of the
logic of a decision which specifies the possible
conditions for the decision and the resulting
actions.
Best used for complicated decision logic.
Note: for salaried employees the action stub chosen will always
be the sametherefore hours worked is an indifferent condition
Reduced Decision Table
Conditions/ Rules
Actions
Passed SIM3300 Y Y N N
Passed SIM3301 Y N Y N
Register SIM4200 X
Drop SIM4200 X X X
Case Study: Payroll System
In one company, the salary for employee is determined by
these rules. The salary is determined through the type
whether salary or hourly. Employee, who has type of salary,
will get a pay base salary. Type of hours worked has three
values. For worker who worked less than 40 hours, the
system will calculate the hourly pay and make an entry in the
absence report. For an hourly worker who has worked
exactly 40 hours, system will calculate the hourly wage. For
employee who worked more than 40 hours, system will
calculate the hourly pay and overtime.
How to calculate rules?
If all conditions are simply Y/N
Number of Values to the values:
power of the number of 2number of conditions
causes with these values
If 1 condition with 3 values and
3 conditions with 2 values:
31 * 23 = 24
Or, use the values column and
multiply each condition value for
example:
3*2*2*2=24
June 2002 63
Decision Tables
65
Exercise
A salary scale for a system analyst has 3 different scale points. All applicants for
the post are placed on the scale according to the following criteria:
Applicants above age 30 with who have BOTH a degree in Computing Science AND 8
year of relevant experience are placed on the scale of 3 points.
Applicants above age 30 with EITHER a degree in Computing Science OR 8 years
of relevant experience are placed on the scale of 2 points.
Applicants of age 30 and below with BOTH a degree in Computing Science AND 8
years of relevant experience are placed on the scale of 2 points.
Applicants of age 30 and below with EITHER a degree in Computing Science OR 8
years of relevant experience are placed on the scale of 1 points.
All other applicant are rejected
Construct a DECISION TABLE and DECISION TREE for the placing of candidates on
the salary scale.
Possible Solution
Conditions / Rules
Actions
Age >30 >30 >30 >30 30 30 30 30
Degree CS CS XCS XCS CS CS XCS XCS
8 years Experience Y T Y T Y T Y T
3 Points X
2 Points X X X
1 Point X X
Reject Application X X
Possible Solution
Conditions / Rules
Actions
Age >30 >30 >30 - 30 30 30 -
Degree CS CS XCS XCS CS CS XCS XCS
8 years Experience Y T Y T Y T Y T
3 Points X
2 Points X X X
1 Point X X
Reject Application X X
Possible Solution
Conditions / Rules
Actions
Age >30 >30 >30 - 30 30 30 -
Degree CS CS XCS XCS CS CS XCS XCS
8 years Experience Y T Y T Y T Y T
3 Points X
2 Points X X X
1 Point X X
Reject Application X X
Simplified Solution
Conditions / Rules
Actions
Age >30 >30 >30 - 30 30 30
Degree CS CS XCS XCS CS CS XCS
8 years Experience Y T Y T Y T Y
3 Points X
2 Points X X X
1 Point X X
Reject Application X
Summary
In this chapter you have learned how to:
describe the term Black-box
describe the importance and role of black-box testing
approach
describe the black-box testing techniques
design test cases using the black-box testing techniques
such as:
equivalence partitioning technique
boundary value analysis
decision table
71