Lecture 4
Lecture 4
0/
EXHAUSTIVELY TESTING IS NOT POSSIBLE
è How to choose?
è Testing techniques help to find the best test case to decrease the failure
risk.
1/
OVER QUALITY – UNDER QUALITY
We should adjust the testing in order to find the right balance (test effort).
2/
TEST TYPE
3/
TESTING TYPE DURING PROJECT
Static Analysis
Structural coverage
Functional test
4/
TESTING TECHNIQUE (FUNCTIONAL)
è Objective :
§ Depending on system, number of test cases are infinite.
è Findaccurate testing methods to get useful test cases among the infinity of Test
Cases
§ System complexity
§ System testability
§ Test level
5/
DEFINITION
6/
TEST TECHNIQUE
è Based on data
§ Equivalence testing.
§ Boundary values testing.
§ Decision table
§ Pair Wise
è Based on behavior
§ State diagram
§ Use Case
7/
EQUIVALENCE CLASSES
8/
EQUIVALENCE CLASSES
9/
SAMPLE
0 4 120
P1 P2 P3
10 /
RULES
è This technique can be applied on any test level (unit test to acceptance
testing)
11 /
MORE COMPLEX SAMPLE
è Bank loan
è Duration of the loan between 5 and 30 years, other values are rejected.
12 /
DOMAIN
è Age
18 80
è Duration
5 30
13 /
CLASSES FOR AGES
14 /
EXAMPLE OF VALUE COMBINATION
15 /
COMBINATION, HOW FAR?
è Here
§ All valid classes have been exercised.
§ Invalid classes are always combined with valid classes in order to check « rejection
behavior » is really linked to one invalid classes.
16 /
BOUNDARY VALUES
Boundary
Invalid Values
values
Valid Values
17 /
EQUIVALENCE CLASSE/ BOUNDARY VALUE
3 equivalence
Classe 1 Classe 2 Classe 3
classes
2 boundaries
and 4 values to
test them.
V1 V2
18 /
BANK LOAN EXAMPLE
è Bank loan
è Duration of the loan between 5 and 30 years, other values are rejected.
§ Between 5 and 10 loan rate: 3,5%
§ Between 11 and 20 loan rate: 3,8%
§ Between 21 and 30 loan rate: 4%
C8 5 C5 10 C6 20 C7 30 C9
è REQ_0001
If myIntVar is greater than 64 then mysoftware shall set myOutput to
myIntVar, otherwise mysoftware shall set myOutput to minus myIntVar
è REQ_0002
If myIntVar is invalid, mysoftware shall set myOutput to -1
è Data dictionnary:
§ myIntVar (integer) Range: [-1024;-64] ∪ [64;1024]
§ myOutput (integer)
20 /
TEST CASES
21 /
EXAMPLE WITH REAL
è REQ_0002
§ If myFltVar invalid and negative, mysoftware shall set myOutput to -86401.0
§ If myFltVar invalid and positive, mysoftware shall set myOutput to 86401.0
è Data dictionnary:
§ myFltVar Float64 in [-86400.0;86400.0]
§ myOutput Float64 out [-86401.0;86401.0]
22 /
TEST CASES
è Boundaries
values: MIN_DOUBLE, -86400.0 , -86400.0 –e, 86400.0, 86400.0+e,
MAX_DOUBLE
23 /
LIMIT VALUES : CASE OF CRITICAL FUNCTION
2 3
è By using 2 and 3 as input for checking limit value we can show the change
of behavior between partition 1 and partition 2 so in most cases only 2
values are needed. P1 P2
1 2 3
è Incase of critical function you may add a third one, the value just before
the limit.
24 /
CONDITION TABLE
Condition 1 Behavior 1
Condition 2 Behavior 2
. Item under test .
. .
Condition n Behavior m
Combinate
25 /
CONDITION TABLE : HOW TO
è Simplify table :
§ Suppress all impossible combination
§ Suppress all combination where condition do not not have influence
on decision
26 /
CONDITION TABLE
A1 X X X X X
A2 X X X
TC1-TC2
Y
Y
-
X
27 /
EXAMPLE : CASH DISPENSER
Conditions
Invalid card Yes No No No No
Bad code pin - Yes No No No
overdrawn account - - Yes No No
Not enough money - - - Yes No
Behavior
Reject card X X
No transaction X
Transaction rejected X
Transaction accepted X
28 /
OTHER EXAMPLE
Conditions
Input >= VAL2 Yes No No
VAL1 < Input < VAL2 No Yes No
Input <= VAL1 No No Yes
Behavior
Algo 1 Yes No No
Algo 2 No Yes No
No Algorithm No No Yes
29 /
TABLE WITH NON BOOLEAN CONDITION
è Example
è3 parameters:
30 /
TABLE WITH NON BOOLEAN CONDITION
ty M M M M M M M M M M M M F F F F F F F F F F F F
c R R R R B B B B W W W W R R R R B B B B W W W W
o
si 36 3 4 4 3 3 4 4 3 3 4 4 3 3 4 4 3 3 4 4 3 3 4 4
8 0 2 6 8 0 2 6 8 0 2 6 8 0 2 6 8 0 2 6 8 0 2
pr 10 11 1 1 1 11 1 1 11 1 1 1 11 1 1 1 11 1 1 1 1 1 1 1
2 3 0 2 3 2 3 4 2 3 4 2 3 4 2 3 4 5
31 /