You are on page 1of 50

Test

Techniques

Chapter 3
Topics

Categories of Black-box Test


Test Techniques Techniques
Subtopics Learning Objectives
Categories of Test Explain the characteristics,
Learning Techniques commonalities, and
differences between black-
Objectives box test
techniques, white-box test
techniques, and experience-
based test techniques
Test techniques

• A procedure used to define test conditions, design test


cases, and specify test data.
Consideration Factors for Choosing Test
Techniques

Component or Customer or
Regulatory Risk levels and Available
system contractual
standards types documentation
complexity requirements

The types of
Software
Tester knowledge defects expected
Available tools Time and budget development
and skills in the component
lifecycle model
or system
Categories of Test Techniques and Their
Characteristics

black-box

white-box

experience-based
Black-box Test
Techniques
• also called behavioral or behavior-based techniques
• based on an analysis of the appropriate test basis
• applicable to both functional and nonfunctional testing.
• 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


• based on an analysis of the architecture, detailed
design, internal structure, or the code of the test
object.
• 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.
• combined with black-box and white-box test techniques.
Common characteristics of black-box test
techniques
Black-box test White-box test techniques Experience-based test
techniques techniques
Reference to derive test basis such as test basis such as software knowledge and
test condition, test software architecture, detailed experience of testers,
cases and test data requirements, design, or any other source developers, users and
specifications, use cases, of information regarding the other stakeholders
and user stories structure
of the software
Coverage based on the items tested based on the items tested
Measurement in the test basis and the within a selected structure
technique applied to (e.g., the code or
the test basis interfaces) and the
technique applied to the
test basis
Topics

Categories of Black-box Test


Test Techniques Techniques
Black-box Test Techniques

Equivalence Boundary Value


State Transition Testing
Partitioning Analysis

Decision Table Testing Use Case Testing


Inputs to the software or system are
divided into groups that are expected
to exhibit similar behaviour, so they are
likely to be processed in the same way

Equivalence
Equivalence partitions
partitioning
-Valid data
(or classes): -invalid data

(EP)

Applied to human input, input via


interfaces to a system, or interface
parameters in integration testing.
• Valid input: integers in the range 100 to 999
EP Case 1
• A mail-order company charges RM2.95 postage
for deliveries if the package weighs less than 2 kg,
RM3.95 if the package weighs 2 kg or more but
less than 5 kg, and RM5 for packages weighing 5
kg or more. Generate a set of valid test cases
using equivalence partitioning.
• What about invalid partitions?

EP Case 2
In an Examination, a candidate must score a
minimum of 24 marks in order to clear the exam.
The maximum that he can score is 40 marks.
Identify the Valid Equivalence values if the
student clears the exam.

EP Case 3
a) 22,23,26
b) 21,39,40
c) 29,30,31
d) 0,15,22
One of the fields on a form contains a text box
that accepts alphanumeric values. Identify the
Valid Equivalence class

EP case 4 a) BOOK
b) Book
c) Boo01k
d) Book
The Switch is switched off once the temperature
falls below 18 and then it is turned on when the
temperature is more than 21. When the
temperature is more than 21. Identify the
Equivalence values which belong to the same
class.
EP Case 5
a) 12,16,22
b) 24,27,17
c) 22,23,24
d) 14,15,19
Boundary value analysis

Complement the can only be used when the Boundary values : the Test on the boundary values
equivalence partitioning partition is ordered, minimum and maximum for a given range of inputs:
consisting of numeric or values (or first and last - min
sequential data. values) of a partition
- min - 1
- min + 1
- max

Lower - max - 1
Upper
boundary (min) boundary (max) - max + 1
• Valid input: integers in the range 100 to 999

BV Case 1
A wholesaler sells printer cartridges. The
minimum order quantity is 5. There is a 20%

BV Case 2 discount for orders of 100 or more printer


cartridges. You have been asked to prepare
test cases using various values for the number
of printer cartridges ordered.
An input field takes the year of birth between
1900 and 2004
The boundary values for testing this field are

BV Case 3 A. 0,1900,2004,2005
B. 1900, 2004
C. 1899,1900,2004,2005
D. 1899, 1900, 1901,2003,2004,2005
BV Case 4

An input field takes the year of birth between 1900 and 2004
The boundary values for testing this field are
A. 0,1900,2004,2005
B. 1900, 2004
C. 1899,1900,2004,2005
D. 1899, 1900, 1901,2003,2004,2005
BV Case 5

In a system designed to work out the tax to be paid:


• An employee has RM4000 of salary tax free.
• The next RM1500 is taxed at 10%.
• The next RM28000 after that is taxed at 22%.
• Any further amount is taxed at 40%.
• To the nearest whole value, which of these is a valid Boundary Value Analysis test case?
• A. RM28000.
• B. RM33501.
• C. RM32001.
• D. RM1500.
Decision table
testing

• Used to test complex decision


making
• Test the combination of
conditions
Study the following requirements for an online bookstore
1. A new customer has to pay in advance for the
transactions.
2. If the amount of transactions a customer made in the
previous month was more than RM1,000, but the amount
of transaction is less than RM500 this time, allow the
customer to pay in advance and pay upon delivery.

DT Case1
3. If the amount of transactions a customer made in the
previous month was more than RM1,000, and if the
amount of transaction is more than RM500 this time,
allow the customer to pay in advance or pay upon delivery
but with 15% prior deposit.
4. If the amount of transactions a customer made in the
previous month was less than RM1,000, request the
customer to pay in advance.
Given the following business rules to decide on
ordering items for the pizza production.

Orders for the pizza production items depend


on the perishability of items. If an item is
perishable (meat, veggies, etc.), a standing
DT Case 2 order stating the quantity to be delivered is
automatically generated and sent to a supplier.
For non-perishable items (cups, napkins, etc.), a
standard order is placed only when the
quantity on hand reaches a predefined
minimum; otherwise, no order is issued.
Given the following requirements:

A mutual insurance company has decided to float its


shares on the stock exchange and is offering its
members rewards for their past custom at the time of
flotation. Anyone with a current policy will benefit
DT Case 3 provided it is a ‘with-profits’ policy and they have held it
since 2001. Those who meet these criteria can opt for
either a cash payment or an allocation of shares in the
new company; those who have held a qualifying policy
for less than the required time will be eligible for a cash
payment but not for shares.
DT Case 4

Given this decision table, what is the expected result for the following
test cases?

TCI: A 26-year-old on business but with violations or accidents on his


driving record
TC2: A 62-year-old tourist with a clean driving record

(A) TCI: Don't supply car; TC2: Supply car with premium charge.
(B) TCI: Supply car with premium charge; TC2: Supply car with
no premium charge.
(C) TCI: Don't supply car; TC2: Supply car with no premium
charge.
(D) TCI: Supply car with premium charge; TC2: Don't supply car.
DT Case 5
You are testing a banking subsystem that provides overdraft
protection customers who have this feature for their checking
accounts. Overdraft protection allows the customer to
temporarily overdraw their balance, with some predefined credit
limit, without having checks returned. A portion of the decision
table describing that feature as shown.

How many test would you design to cover the decision table?
(A) 3
(B) 2
(C) 5
(D) 15
STATE TRANSITION
DIAGRAMS State Transition

• A representation of the behaviour of a


system.
• Consists of two symbols:
• Analyse the behaviour in terms of what • System in a stable • Labelled with an
happens when a transition occurs. condition event that caused it
• will only change if it is and any action arises
stimulated by from it.
an event of some kind • Event - anything that
acts as a trigger for a
change
ST Case 1

A hill-walker’s watch has two modes: Time and Altimeter. In Time mode,
pressing the Mode switch causes the watch to switch to Alt mode; pressing
Mode again returns to Time mode. While the watch is in Alt mode the Set
button has no effect.
When the watch is in Time mode pressing the Set button transitions the watch
into Set Hrs, from which the Hrs display can be incremented by pressing the
Set button. If the Mode switch is pressed while the watch is in Set Hrs mode
the watch transitions to Set Mins mode, in which pressing the Set button
increments the Mins display. If the Mode button is pressed in this mode the
watch transitions back to Time mode
ST Case 2

A website shopping basket starts out as empty. As purchases are


selected, they are added to the shopping basket. Items can also
be removed from the shopping basket. When the customer
decides to check out, a summary of the items in the basket and
the total cost are shown, for the customer to say whether this is OK
or not. If the contents and price are OK, then you leave the
summary display and go to the payment system. Otherwise you
go back to shopping (so you can remove items if you want).
ST Case 3

Based on the given State Transition Diagram of a


switch, which of the following test case is invalid?
A. OFF to ON
B. ON to OFF
C. FAULT to ON
D. ON to FAULT
ST Case 4

Given the following state transition, which of the


following series of state transitions below will provide
100% 0-switch coverage.
A. A,B,E,B,C,F,D
B. A,B,E,B,C,F,F
C. A,B,E,B,C,D
D. A,B,C,F,F,D
ST Case 5

Given the state diagram which test


case is the minimum series of valid
transitions to cover every state?
a. SS-S1-S2-S4-S1-S3-ES
b. SS-S1-S2-S3-S4-ES
c. SS-S1-S2-S4-S1-S3-S4-S1-S3-ES
d. SS-S1-S4-S2-S1-S3-ES
Use case : interactions between actors (users or systems),
which produce a result of value to a system user or the
customer.

Described at the abstract level (business use case,


technology-free, business process level) or at the system
level (system use case on the system functionality level).

Use Case Advantage of Use Case Tests :


Testing • uncovering defects in the process flows during real-world use of the
system
• useful for designing acceptance tests with customer/user participation
• uncover integration defects caused by the interaction and interference of
different components

Designing test cases from use cases may be combined


with other specification-based test techniques.
• A scenario is an instance of a use case

Use case • That is, it is a use case execution wherein a


specific user executes the use case in a
scenarios specific way
Use case scenarios
Start use case

Alternative flow 3
Alternative flow 1

Alternative flow 2

Alternative flow 4

end use case

end use case

end use case


Deriving test cases from use cases:
A four step processes

1 2 3 4
Identify the use For each For each test Complete the
case scenarios scenario, identify case, identify the test case by
one or more test conditions that adding data
cases will cause it to values
execute.
• Use simple matrix that can be implemented in a
spreadsheet, database or test management tool.
• Number the scenarios and define the
combinations of basic and alternative flows that
leads to them.
Identify the • Many scenarios are possible for one use case
use case • Not all scenarios may be documented .. Use an

scenarios iterative process


• Not all documented scenarios may be tested
• Use cases may be at a level that is insufficient
for testing
• Team’s review process may discover
additional scenarios
Identify the use case scenarios
Example
Scenario Originating Alternative Next Next
number flow flow alternative alternative
1 Basic flow
2 Basic flow Alt. flow 1
3 Basic flow Alt. flow 1 Alt. flow 2
4 Basic flow Alt. flow 3
5 Basic flow Alt. flow 3 Alt. flow 1
6 Basic flow Alt. flow 3 Alt. flow 1 Alt. flow 2
7 Basic flow Alt. flow 4
8 Basic flow Alt. flow 3 Alt. flow 4
• Parameters of any test case:
• Conditions
Identify the test • Input (data values)

cases • Expected result


• Actual result

Test Scenario/ Data Data Data Exp. Actual


case conditon value 1 value 2 value N results results
ID
1 Scenario 1
2 Scenario 2
3 Scenario 3
Identify the test conditions
• For each test case identify the conditions that will cause it to execute a specific events.
• Use matrix with columns for the conditions and for each condition state whether it is
• valid (V): must be true for the basic flow to execute
• Invalid (I): this will invoke an alternative flow
• Not applicable (N/A): to the test case
Add data values to complete the test cases

Design real input data values that will make You may want to look at the use case
such conditions to be valid or invalid and constructs and branches.
hence the scenarios to happen.
UT Case 1
UT Case 2
UT Case 3
Given the following requirement for a scheduler website:

After a meeting was scheduled, an attendee should get an invitation with a


link to the scheduled meeting website, where several dates are proposed.
The attendee should be able to enter in the scheduled meeting website his
name and the dates, when he could attend. It should be possible to add or
delete agreements on proposed dates at any time. The website should be
accessible in less than 5 seconds.

Identify the test cases that should be created using the use case technique.
Technique Model Typical defects that can be
found using this
technique

Equivalence Domain Wrong handling of data/domain


partitioning model values

SUMMARY Boundary
value
Domain
model
Wrong handling of data on the
domain boundaries
OF BLACK analysis

BOX
Decision Decision Wrong handling of the business
table logic rules
testing model
TECHNIQUES State Behavioral Wrong handling of transitions
transition model between states
testing

Use case Business Wrong handling of the business


testing process processing
model
End of Chapter 3

You might also like