SW 6
SW 6
Testing 1
Background
Testing 2
Faults & Failure
Testing 3
Role of Testing
Testing 4
Detecting defects in Testing
Testing 5
Test Oracle
Testing 6
Role of Test cases
Testing 7
Test case design
Testing 8
Black Box testing
Testing 9
Black box Testing…
Testing 10
Black Box Testing…
◼ Most thorough functional testing - exhaustive
testing
◼ Software is designed to work for an input space
◼ Test the software with all elements in the input space
◼ Infeasible - too high a cost
◼ Need better method for selecting test cases
◼ Different approaches have been proposed
Testing 11
Equivalence Class partitioning
Testing 12
Equivalence class partitioning…
Testing 13
Equivalent class partitioning..
Testing 14
Equivalent class partitioning..
Testing 15
Equivalence class…
Testing 16
Example
Testing 17
Example..
Testing 18
Example…
Testing 19
Boundary value analysis
Testing 20
BVA...
Testing 21
BVA…
◼ In Boundary Value Analysis we determine the
value of variables that should be used
◼ If input is a defined range, then there are 6
boundary values plus 1 normal value (total: 7)
◼ min = 1, min, min+1, max – 1, max, max+1
(boundary values
◼ .5 (normal value)
◼ If multiple inputs, how to combine them into
test cases; two strategies possible
◼ Try all possible combinations of Boundary Values of
different variables, with n variables this will have 7n
test cases!
◼ Select Boundary Value for one variable; have other
variables at normal values + 1 of all normal values
Testing 22
Boundary Value Analysis..
test cases for two variables – X and Y (13 test cases)
Testing 23
Cause Effect graphing
Testing 24
Cause Effect graphing
Testing 25
Cause Effect graphing
Testing 26
Cause Effect graphing: Example
◼ A bank database which allows two commands
◼ Credit acc# amt
◼ Debit acc# amt
◼ Requirements
◼ If credit and acc# valid, then credit
◼ If debit and acc# valid and amt less than balance,
then debit
◼ Invalid command - message
Testing 27
Example…
◼ Causes
◼ C1: command is credit
◼ C2: command is debit
◼ C3: acc# is valid
◼ C4: amt is valid
◼ Effects
◼ Print “Invalid command”
◼ Print “Invalid acct#”
◼ Print “Debit amt not valid”
◼ Debit account
◼ Credit account
Testing 28
Example…
E4 :Debit
Legend: account
v: or
^: and
Testing 29
Example…
# 1 2 3 4 5
C1 0 1 x x x
C2 0 x 1 1 x
C3 x 0 1 1 1
C4 x x 0 1 1
E1 1
E2 1
E3 1
E4 1
E5 1
1.Set Effect to 1
2.Set Cause that enables that effec
true, false, don’t care
Testing 30
Pair-wise testing
◼ Often many parameters determine the behavior
of a software system
◼ The parameters may be inputs or settings, and
take different values (or different value ranges)
◼ Many defects involve one condition (single-mode
fault), e.g. software not being able to print on
some type of printer
◼ Single mode faults can be detected by testing for
different values of different parameters
◼ If n parameters and each can take m values, we can
test for one different value for each parameter in
each test case
◼ Total test cases: m
Testing 31
Pair-wise testing…
Testing 32
Pair-wise testing…
◼ Full combinatorial testing not feasible
◼ For n parameters each with m values, total
combinations are nm
◼ For 5 parameters, 5 values each (total: 3125), if one
test is 5 minutes, total time > 1 month!
◼ Research suggests that most such faults are
revealed by interaction of a pair of values
◼ I.e. most faults tend to be double-mode
◼ For double mode, we need to exercise each pair
– called pair-wise testing
Testing 33
Pair-wise testing…
Testing 34
Pair-wise testing…
Testing 35
Pair-wise testing…
Testing 36
Pair-wise testing, Example
Testing 37
Pair-wise testing…
Testing 38
Stop
Testing 39
Special cases
Testing 40
Error Guessing
◼ Use experience and judgement to guess
situations where a programmer might make
mistakes
◼ Special cases can arise due to assumptions
about inputs, user, operating environment,
business, etc.
◼ E.g. A program to count frequency of words
◼ file empty, file non existent, file only has blanks,
contains only one word, all words are same, multiple
consecutive blank lines, multiple blanks between
words, blanks at the start, words in sorted order,
blanks at end of file, etc.
◼ Perhaps the most widely used in practice
Testing 41
State-based Testing
Testing 42
State-based Testing…
Testing 43
State-based Testing…
Transition
Input
State
Testing 44
State-based Testing…
Testing 45
State-based Testing…
Testing 46
State-based Testing criteria
Testing 47
State-based testing…
Testing 48
White box testing
Testing 49
Types of structural testing
Testing 50
Control flow based criteria
Testing 51
Statement Coverage Criterion
Testing 53
Control flow based…
Testing 54
Data flow-based testing
Testing 55
Data flow based…
Testing 56
Data flow based criteria
Testing 57
Relationship between diff criteria
Testing 58
Tool support and test case selection
Testing 59
In a Project
Testing 61
Testing Process
Testing 62
Testing
Testing 63
Incremental Testing
◼ Goals of testing: detect as many defects as
possible, and keep the cost low
◼ Both frequently conflict - increasing testing can
catch more defects, but cost also goes up
◼ Incremental testing - add untested parts
incrementally to tested portion
◼ For achieving goals, incremental testing
essential
◼ helps catch more defects
◼ helps in identification and removal
◼ Testing of large systems is always incremental
Testing 64
Integration and Testing
Testing 65
Top-down and Bottom-up
Testing 66
Levels of Testing
Testing 67
Levels of Testing…
Testing 68
Unit Testing
Testing 69
Integration Testing
Testing 70
System Testing
Testing 72
Other forms of testing
◼ Performance testing
◼ Tools needed to “measure” performance
◼ Stress testing
◼ load the system to peak, load generation tools
needed
◼ Regression testing
◼ Test that previous functionality works alright
◼ Important when changes are made
◼ Previous test records are needed for comparisons
◼ Prioritization of test cases needed when complete
test suite cannot be executed for a change
Testing 73
Test Plan
Testing 74
Test Plan…
Testing 75
Test case specifications
Testing 76
Test case specifications…
Testing 77
Test case specifications…
◼ The effectiveness and cost of testing depends
on the set of test cases
◼ Q: How to determine if a set of test cases is
good? I.e. the set will detect most of the
defects, and a smaller set cannot catch these
defects
◼ No easy way to determine goodness; usually the
set of test cases is reviewed by experts
◼ This requires test cases be specified before
testing – a key reason for having test case
specifications
◼ Test case specifications are essentially a table
Testing 78
Test case specifications…
Testing 79
Test case specifications…
Testing 80
Test case execution and analysis
Testing 81
Defect logging and tracking
Testing 82
Defect logging…
Testing 83
Defect logging…
Testing 84
Defect logging…
Testing 85
Defect logging…
Testing 86
Defect logging and tracking…
Testing 87
Defect arrival and closure trend
Testing 88
Defect analysis for prevention
Testing 89
Metrics - Defect removal efficiency
Testing 90
Defect removal efficiency …
Testing 91
Defect Removal Efficiency …
Testing 92
Metrics – Reliability Estimation
Testing 93
Reliability Estimation…
Testing 94
Summary
Testing 95
Summary …
Testing 96
Summary…
Testing 97