Chapter 4 Test Techniques
Chapter 4 Test Techniques
Test Techniques
Categories of Test Techniques and their
characteristics
• Black-box test techniques (also called behavioral or behavior-based
techniques) are based on an analysis of the appropriate test basis
(e.g., formal requirements documents, specifications, use cases,user
stories, or business processes). These techniques are applicable to
both functional and nonfunctional testing. Black-box test techniques
concentrate on the inputs and outputs of the test object without
reference to its internal structure.
• White-box test techniques (also called structural or structure-based
techniques) are based on an analysis of the architecture, detailed
design, internal structure, or the code of the test object. Unlike black-
box test techniques, white-box test techniques concentrate on the
structure and processing within the test object.
• Experience-based test techniques leverage the experience of
developers, testers and users to design, implement, and execute tests.
These techniques are often combined with black-box and white-box
test techniques.
Common Characteristics – Black Box
Common characteristics of black-box test techniques include the
following:
Test conditions, test cases, and test data are derived from a test basis
that may include software requirements, specifications, use cases, and
user stories
Test cases may be used to detect gaps between the requirements
and the implementation of the requirements, as well as deviations
from the requirements
Coverage is measured based on the items tested in the test basis and
the technique applied to the test basis
Common Characteristic – White Box
Test conditions, test cases, and test data are derived from a test basis
that may include code, software architecture, detailed design, or any
other source of information regarding the structure
of the software
Coverage is measured based on the items tested within a selected
structure (e.g., the code or interfaces)
Specifications are often used as an additional source of information
to determine the expected outcome of test cases
Common Characteristic – Experience Based
Test conditions, test cases, and test data are derived from a test basis
that may include knowledge and experience of testers, developers,
users and other stakeholders
Black Box Testing
1) Equivalence Partitioning(EP)
• Equivalence partitioning divides data into partitions (also known as
equivalence classes) in such a way that all the members of a given partition
are expected to be processed in the same way (see Kaner 2013 and
Jorgensen 2014). There are equivalence partitions for both valid and invalid
values.
• Each value must belong to one and only one equivalence partition
• To achieve 100% coverage with this technique, test cases must cover all
identified partitions (including
invalid partitions) by using a minimum of one value from each partition.
Applicable at all test levels.
Grade Marks
A 80-100
B 60-79
C 50-59
F Below 50
What are the values for testing if the following technique is used:
Black Box Test :Decision table testing
• Combinatorial test techniques are useful for testing the
implementation of system requirements that specify how different
combinations of conditions result in different outcomes.
• Decision tables are a good way to record complex business rules that
a system must implement. When creating decision tables, the tester
identifies conditions (often inputs) and the resulting actions (often
outputs) of the system. These form the rows of the table, usually with
the conditions at the top and the
actions at the bottom
Decision table (Continued.)
• For system which contains logical conditions and business rules that
are complex
• define input conditions and action of the system base time or false
value
• decision table defines:
Condition/Rules
• a set of trues and1 or false what Tactions
Condition T needed.
Condition 2 T T
• table: Actions
Action 1 Y
Action 2 Y
Decision Table Continued.
• The common minimum coverage standard for decision table testing is to
have at least one test case per decision rule in the table. This typically
involves covering all combinations of conditions. Coverage is measured as
the number of decision rules tested by at least one test case, divided by the
total number of
decision rules, normally expressed as a percentage.
• Example:
A priority customer who order more than RM10,000
is entitled to a 10% discount. An additioal 5% if he use a debit card.
Priority customer who order less than Rm10,000 shall receive RM50 bonus
discount.
Non-priority customer shall be ginven RM5 discount on any purchase.
Black Box Testing – State Transition
• A state transition table shows all valid transitions and potentially invalid
transitions between states, as well as the events, guard conditions, and
resulting actions for valid transitions. State transition diagrams normally
show only the valid transitions and exclude the invalid transitions.
• Tests can be designed to cover a typical sequence of states, to exercise all
states, to exercise every transition, to exercise specific sequences of
transitions, or to test invalid transitions.
• Data Flow-Based
– All definitions (all defs)
– All definition-use pairs (all def-uses)
•
• Condition-Based
– (Simple) Condition coverage
– Multiple Condition coverage
Example
int main ()
{
int a: //L1
cout << "Enter value : \n"; //L2
cin >> a; //L3
if (a >= 100) //L4
{
for (int n = 1; n<=10 ; n++) //L5
{
cout << "Hello \n"; //L6
}
}
cout << "Thank you \n" ; //L7
return 0; //L8
}
Example (Continued.)
• Statement coverage:
• Decision Coverage:
• Path coverage:
• Exploratory Testing
• Checklist-Based Testing
• Checklists can be created to support various test types, including functional and
non-functional testing. In the absence of detailed test cases, checklist-based
testing can provide guidelines and a degree of consistency. As these are high-level
lists, some variability in the actual testing is likely to occur, resulting
in potentially greater coverage but less repeatability.