ISTQBCH4
ISTQBCH4
ISTQBCH4
1 Principles
2 Lifecycle
4 Dynamic test
5 Management
techniques
Chapter 4
3 Static testing
6 Tools
Contents
What is a testing technique?
Black and White box testing
Black box test techniques
White box test techniques
Error Guessing
Advantages of techniques
Measurement
Project B
40% Equivalence
partitions
45% Boundaries
60% Branches
Contents
What is a testing technique?
Black and White box testing
Black box test techniques
White box test techniques
Error Guessing
Static
Static
etc.
Reviews
Inspection
Walkthroughs
Structural
Structural
Desk-checking
Symbolic
Execution
Non-functional
Non-functional
Functional
Functional
etc.
etc.
Control
Flow
Data
Flow
etc.
Behavioural
Behavioural
Static Analysis
Performance
etc.
Statement
Branch/Decision
Definition
-Use
Branch Condition
Equivalence
Partitioning
Usability
Arcs
LCSAJ
Branch Condition
Combination
Boundary
Value Analysis
Cause-Effect Graphing
Random
State Transition
Acceptance
Acceptance
System
System
Integration
Integration
Component
Component
Contents
What is a testing technique?
Black and White box testing
Black box test techniques
White box test techniques
Error Guessing
valid
0
100
invalid
101
valid
0
invalid
100 101
Example: Loan
application
Customer Name
Account number
Loan amount requested
Term of loan
Monthly repayment
Term:
Repayment:
Interest rate:
Total paid back:
2-64 chars.
6 digits, 1st
non-zero
500 to 9000
1 to 30 years
Minimum 10
Customer name
Number of characters:
invalid
Valid characters:
Conditions
Customer
name
Valid
Partitions
2 to 64 chars
valid chars
valid
A-Z
- a-z
space
Invalid
Partitions
<2 chars
>64 chars
invalid chars
64 65
invalid
Any
other
Valid
Boundaries
2 chars
64 chars
Invalid
Boundaries
1 chars
65 chars
0 chars
Account number
first character:
valid: non-zero
invalid: zero
number of digits:
invalid
Conditions
Account
number
Valid
Partitions
6 digits
1st non-zero
Invalid
Partitions
<6 digits
>6 digits
1st digit =0
non-digit
valid
Valid
Boundaries
100000
999999
invalid
Invalid
Boundaries
5 digits
7 digits
0 digits
Loan amount
499
invalid
Conditions
Loan
amount
Valid
Partitions
500 - 9000
500
9000
valid
Invalid
Partitions
<500
>9000
0
non-numeric
null
9001
invalid
Valid
Boundaries
500
9000
Invalid
Boundaries
499
9001
Condition template
Conditions
Valid
Partitions
Tag
Customer 2 - 64 chars
name
valid chars
V1
V2
Account
number
6 digits
1st non-zero
V3
V4
Loan
amount
500 - 9000
V5
Invalid
Partitions
Valid
Invalid
Tag
Tag
Boundaries
Boundaries
< 2 chars
X1 2 chars
B1 1 char
D1
> 64 chars
X2 64 chars
B2 65 chars
D2
invalid char X3
0 chars
D3
< 6 digits
X4 100000
B3 5 digits
D4
> 6 digits
X5 999999
B4 7 digits
D5
st
1 digit = 0 X6
0 digits
D6
non-digit
X7
< 500
X8 500
B5 499
D7
>9000
X9 9000
B6 9001
D8
0
X10
non-integer X11
null
X12
Tag
Description
Expected Outcome
New Tags
Covered
Name:
Acc no:
Loan:
Term:
John Smith
123456
2500
3 years
Term:
Repayment:
Interest rate:
Total paid:
3 years
79.86
10%
2874.96
V1, V2,
V3, V4,
V5 .....
Name:
Acc no:
Loan:
Term:
AB
100000
500
1 year
Term:
Repayment:
Interest rate:
Total paid:
1 year
44.80
7.5%
537.60
B1, B3,
B5, .....
Test objectives?
Condition
Valid
Tag Invalid
Tag Valid
Partition
Partition
Boundary
Tag Invalid
Boundary
Tag
Decision tables
policy expired
account in credit
due date > current date
Input Conditions
Valid username
Valid password
Account in credit
Output Conditions
Login accepted
Restricted access
Input Conditions
Valid username T T T T F F F
Valid password T T F F T T F
Account in credit T F T F T F T
F
F
F
Input Conditions
Valid username F
Valid password
Account in credit -
T T T
F T T
- F T
Input Conditions
Valid username F
Valid password
Account in credit Output Conditions
Login accepted
F
Restricted access -
T T T
F T T
- F T
F
-
T T
T F
Input Conditions
Valid username F
Valid password
Account in credit Output Conditions
Login accepted
F
Restricted access Tags A
T T T
F T T
- F T
F T T
- T F
B C D
Test Description
1
2
3
4
5
Username BrbU
Username
usernametoolong
Username BobU
Password abcd
Valid user, no disc
space
Valid user with disc
space
Expected Outcome
Tag
Invalid username
Invalid username
A
A
Invalid password
Restricted access
Unrestricted access
Rationalising outputs
Y
Z
F
F
T
F
F
T
is equivalent to:
Output
Rationalising dangers
Code = 1, 2, or 3 1 1 1 1 2 2 2 2 3 3 3 3
Exp.date < now T T F F T T F F T T F F
Class A product T F T F T F T F T F T F
Output value
FALSE
TRUE
Contents
What is a testing technique?
Black and White box testing
Black box test techniques
White box test techniques
Error Guessing
Tests
Enough
tests?
Software
Software
Results OK?
More tests
What's
covered
?
Coverage OK?
Stronger structural
techniques (different
structural elements)
Increasing coverage
Function
Function exercised,
exercised,
insufficient
insufficient structure
structure
Functional
testedness
Structure
Structure exercised,
exercised,
insufficient
insufficient function
function
% Statement
% Decision
Structural testedness
100%
100% coverage
coverage does
does
not
not mean
mean 100%
100% tested!
tested!
% Condition
Combination
Coverage
Coverage isis not
not
Thoroughness
Thoroughness
Statement coverage
Statement
Statement coverage
coverage
is
is normally
normally measured
measured
by
by aa software
software tool.
tool.
Typical
Typical ad
ad hoc
hoc testing
testing achieves
achieves 60
60 -- 75%
75%
read(a)
IF a > 6 THEN
b=a
ENDIF
print b
Statement
numbers
Test
case
Input
Expected
output
Decision coverage
(Branch coverage)
Decision
Decision coverage
coverage
is
is normally
normally measured
measured
by
by aa software
software tool.
tool.
Typical
Typical ad
ad hoc
hoc testing
testing achieves
achieves 40
40 -- 60%
60%
1234
12
12
123
?
?
Example 1
Wait for card to be inserted
IF card is a valid card THEN
display Enter PIN number
IF PIN is valid THEN
select transaction
ELSE (otherwise)
display PIN invalid
ELSE (otherwise)
reject card
End
Wait
Valid
card?
Yes
Display
Enter..
No
Reject
card
Valid Yes
PIN?
No
Select
trans...
Display
PIN in..
End
Example 2
Read A
IF A > 0 THEN
IF A = 21 THEN
Print Key
ENDIF
ENDIF
Read
A>0
Yes
No
End
3
- Cyclomatic complexity: _____
- Minimum tests to achieve:
1
Statement coverage: ______
3
Branch coverage: _____
A=21
No
Yes
Example 3
Read A
Read B
IF A > 0 THEN
IF B = 0 THEN
Print No values
ELSE
Print B
IF A > 21 THEN
Print A
ENDIF
ENDIF
ENDIF
Read
A>0
No
Yes
B=0
Yes
No
Print
Yes
A>21
No
End
4
- Cyclomatic complexity: _____
- Minimum tests to achieve:
2
Statement coverage: ______
4
Branch coverage: _____
Example 4
Read
A<0
Yes
No
Print
Note: there
Read A
Read B
are 4 paths
IF A < 0 THEN
Yes
B<0
Print
Print A negative
No
ELSE
Print A positive
Print
ENDIF
IF B < 0 THEN
End
Print B negative
ELSE
3
- Cyclomatic complexity: _____
Print B positive
- Minimum tests to achieve:
ENDIF
2
Statement coverage: ______
2
Branch coverage: _____
Read
Example 5
A<0
Yes
No
Read A
Read B
IF A < 0 THEN
Print A negative
ENDIF
IF B < 0 THEN
Print B negative
ENDIF
B<0
Yes
No
End
3
Cyclomatic complexity: _____
Minimum tests to achieve:
1
Statement coverage: ______
2
Branch coverage: _____
Read
Example 6
A<0
Yes
No
Read A
IF A < 0 THEN
Print A negative
ENDIF
IF A > 0 THEN
Print A positive
ENDIF
A>0
Yes
No
End
3
Cyclomatic complexity: _____
Minimum tests to achieve:
2
Statement coverage: ______
2
Branch coverage: _____
Contents
What is a testing technique?
Black and White box testing
Black box test techniques
White box test techniques
Error Guessing
AAtesting
testing approach
approach that
that isis only
only
rigorous,
rigorous, thorough
thorough and
and systematic
systematic
isis incomplete
incomplete
Error-Guessing
Consider:
- past failures
- intuition
- experience
- brain storming
- What is the craziest thing we can do?