blackbox
blackbox
Black-box Testing
Inputs causing
anomalous
Input test data I behaviour
e
System
represents a set of
valid or invalid states
for input conditions.
System
Typically, an input
condition is either a
specific numeric
value, a range of
values, a set of
related values, or a
Outputs
Boolean condition.
Equivalence partitioning
16
Aim
• Equivalence class testing strategy is developed
with the following aims
• – To test as few input values as possible
• – To spot and eliminate redundant tests
• – To tell how many tests are necessary to test
a given piece of software to a known level
Example 1
[1..120]
18
Example 1 (contd.)
Further, assume that the application is required to process all values in
the range [1..61] in accordance with requirement R1 and those in the
range [62..120] according to requirement R2.
19
Example 1 (contd.)
All integers
<1
>120
[62-120]
[1..61]
20
Example 1 (contd.)
Tests selected using the equivalence partitioning technique aim at
targeting faults in the application under test with respect to inputs in
any of the four regions, i.e. two regions containing expected inputs
and two regions containing the unexpected inputs.
It is expected that any single test selected from the range [1..61]
will reveal any fault with respect to R1. Similarly, any test
selected from the region [62..120] will reveal any fault with
respect to R2. A similar expectation applies to the two regions
containing the unexpected inputs.
21
Types of Equivalence classes Partition
• Uni-dimensional
• Multi-dimensional
Unidimensional partitioning
One way to partition the input domain is to consider one
input variable at a time. Thus each input variable leads to
a partition of the input domain. We refer to this style of
partitioning as unidimensional equivalence partitioning or
simply unidimensional partitioning.
23
Multidimensional partitioning
Another way is to consider the input domain I as the set product
of the input variables and define a relation on I. This procedure
creates one partition consisting of several equivalence classes.
We refer to this method as multidimensional equivalence
partitioning or simply multidimensional partitioning.
Multidimensional partitioning leads to a large number of
equivalence classes that are difficult to manage manually.
24
Partitioning Example
Consider an application that requires two integer inputs x and y.
Each of these inputs is expected to lie in the following ranges:
3 x7 and 5y9.
25
Partitioning Example (contd.)
26
Partitioning Example (contd.)
27
Black Box Testing in detail
• Black Box testing is based on functional
specification
– What we get in functional specifications.
Boundary value analysis
29
Errors at the boundaries
Experience indicates that programmers make mistakes in processing values at and near the
boundaries of equivalence classes.
Obviously, this fault is revealed, though not necessarily, when M is tested against x=0 but
not if the input test set is, for example, {-4, 7} derived using equivalence partitioning. In
this example, the value x=0, lies at the boundary of the equivalence classes x0 and x>0.
30
Boundary value analysis (BVA)
Boundary value analysis is a test selection technique that targets faults in applications at
the boundaries of equivalence classes.
While equivalence partitioning selects tests from within equivalence classes, boundary
value analysis focuses on tests at and near the boundaries of equivalence classes.
Certainly, tests derived using either of the two techniques may overlap.
31
BVA: Procedure
1 Partition the input domain using unidimensional partitioning. This leads to as many
partitions as there are input variables. Alternately, a single partition of an input domain
can be created using multidimensional partitioning. We will generate several sub-
domains in this step.
2 Identify the boundaries for each partition. Boundaries may also be identified using
special relationships amongst the inputs.
3 Select test data such that each boundary value occurs in at least one test input.
32
BVA: Example: 1. Create equivalence
classes
Assuming that an item code must be in the range 99-999 and quantity in the range 1-100,
33
BVA: Example: 2. Identify boundaries
0 2 99 101
* x * * x *
E4 1 100 E6
E5
34
BVA: Example: 3. Construct test set
Test selection based on the boundary value analysis technique requires that tests must
include, for each variable, values at and around the boundary. Consider the following
test set:
35
Important Observation
• Functionality Coverage Test Versus acceptance
Testing
How to choose the input in
functionality test
• What is experimental design
Input Coverage Methods
• Types of Input Coverage Methods
Output Coverage Testing
• What we need for Output Coverage Testing
What is grey box testing
• Example of grey box testing
Graph-Based Testing Methods
• The first step in black-box testing is to
understand the objects that are modeled in
software and the relationships that connect
these objects.
• Once this has been accomplished, the next
step is to define a series of tests that verify “all
objects have the expected relationship to one
another [BEI95].”
Graph-Based Testing Methods
• Stated in another way, software testing begins
by creating a graph of important objects and
their relationships and then devising a series
of tests that will cover the graph so that each
object and relationship is exercised and errors
are uncovered.
Graph-Based Testing Methods
• Nodes are represented as circles connected by links that take a number of
different forms. A directed link (represented by an arrow) indicates that a
relationship moves in only one direction. A bidirectional link, also called a
symmetric link, implies that the relationship applies in both directions.
Parallel links are used when a number of different relationships are
established between graph nodes.
Graph-Based Testing Methods
• Object #1 = new file menu select
• Object #2 = document window
• Object #3 = document text
Transaction flow modeling
• The nodes represent steps in some transaction (e.g.,
the steps required to make an airline reservation
using an on-line service), and the links represent the
logical connection between steps.
82
Test cases
• We could use this very simple state model as a
basis for tests, where following a path in the
model is equivalent to running a test:
– Setup:
• Put the Clock into its Analog display mode
– Action:
• Click on “Settings\Digital”
– Outcome:
• Does the Clock correctly change to the Digital display?
83
Actions
• the following actions in the Clock:
– Start the Clock application
– Stop the Clock application
– Select Analog setting
– Select Digital setting
84
The rules for actions
• The rules for these actions in the Clock application are as follows:
• Start
– If the application is NOT running, the user can execute the Start command.
– If the application is running, the user cannot execute the Start command.
– After the Start command executes, the application is running.
• Stop
– If the application is NOT running, the user cannot execute the Stop command.
– If the application is running, the user can execute the Stop command.
– After the Stop command executes, the application is not running.
•
• Analog
– If the application is NOT running, the user cannot execute the Analog command.
– If the application is running, the user can execute the Analog command.
– After the Analog command executes, the application is in Analog display mode.
• Digital
– If the application is NOT running, the user cannot execute the Digital command.
– If the application is running, the user can execute the Digital command.
– After the Digital command executes, the application is in Digital display mode.
85
Operational modes
• Two modes of operations:
– system mode
• NOT_RUNNING means Clock is not running
• RUNNING means Clock is running
– setting mode
• ANALOG means Analog display is set
• DIGITAL means Digital display is set
86
State Transition Diagram for the Clock
Model
87
An Example
Idle
Caller
Ringing
hung up
You
Connected
hung up
On Hold
Other Black box testing techniques
– Domain
– Function
– Regression
– Specification-based
– User
– Scenario
– Risk-based
– Stress
– High volume stochastic or
random
Domain Testing
mines fixes
Variable Tests are Often More Effective
mines fixes
Specification Based Testing
Test 1 X X X
Test 2 X X
Test 3 X X X
Test 4 X X
Test 5 X X
Test 6 X X
– Risk:
• Possibility of suffering loss or harm (probability of
an accident caused by a given hazard).
– Accident:
• A hazard is encountered, resulting in loss or harm.
Risks: Where to look for errors
• Quality Categories:
– Capability
– Reliability Each quality category is a risk
– Usability category, as in:
– Performance “the risk of unreliability.”
– Installability
– Compatibility – Efficiency – Maintainability
– Supportability – Localizability – Extendibility
– Testability – Portability
post-ship pre-ship
Risk-Based Test Management
• Tasks
– List all areas of the program that could require testing
– On a scale of 1-5, assign a probability-of-failure estimate to each
– On a scale of 1-5, assign a severity-of-failure estimate to each
– For each area, identify the specific ways that the program might fail
and assign probability-of-failure and severity-of-failure estimates
for those
– Prioritize based on estimated risk
– Develop a stop-loss strategy for testing untested or lightly-tested
areas, to check whether there is easy-to-find evidence that the
areas estimated as low risk are not actually low risk.
Stress Testing
S3 S4
E4
Exit
E6
Model Complexity
• One major issue with model based testing is the complexity
of the models required for most programs:
– Difficult to create the model
– Difficult to enter the model in a machine readable form
– Maintenance is a critical issue because design changes add
or subtract nodes and transitions, forcing regeneration of
the model.
• Likely conclusions:
– Works poorly for a complex product like Word
– Likely to work well for embedded software and simple
menus (think of the brakes of your car)
– In general, well suited to a limited-functionality client that
will not be powered down or rebooted very often.
Model-Based Testing
• Strengths
– Doesn’t depend on same old test every time.
– Model unambiguously defines [part of] the product.
– Can detect failures arising out of long, complex chains that
would be hard to create as planned tests.
– Tests can be reconfigured automatically by changing the
model.
• Blind spots
– Need to be able to distinguish pass from fail.
– Model has to match the product.
– Covers some types of risks, but can obscure the need for
other tests that are not amenable to modeling or
automation.