Professional Documents
Culture Documents
Testing
The aim of testing is to identify all
Unit II defects in a software product.
Software Testing However, in practice even after
thorough testing:
one cannot guarantee that the software is
error--free.
error
Testing Testing
The input data domain of most Testing does however expose many
software products is very large: errors:
it is not practical to test the testing provides a practical way of
reducing defects in a system
software exhaustively with each
input data value. increases the users' confidence in a
developed system.
Unit -II: Software Testing 3 Dr. Rabins Porwal Unit -II: Software Testing 4 Dr. Rabins Porwal
Testing Testing
Testing is an important development Many engineers have the wrong
phase: impression:
requires the maximum effort among all
development phases.
testing is a secondary activity
In a typical development organization: it is intellectually not as stimulating
maximum number of software engineers can be as the other development activities,
found to be engaged in testing activities. etc.
Unit -II: Software Testing 5 Dr. Rabins Porwal Unit -II: Software Testing 6 Dr. Rabins Porwal
Unit -II: Software Testing 7 Dr. Rabins Porwal Unit -II: Software Testing 8 Dr. Rabins Porwal
Unit -II: Software Testing 9 Dr. Rabins Porwal Unit -II: Software Testing 10 Dr. Rabins Porwal
Test cases and Test suites Test cases and Test suites
Test a software using a set of A test case is a triplet [I, S, O]
carefully designed test cases: I is the data to be input to the system,
S is the state of the system at which the
the set of all test cases is called the data will be input,
test suite O is the expected output of the system.
Unit -II: Software Testing 13 Dr. Rabins Porwal Unit -II: Software Testing 14 Dr. Rabins Porwal
Unit -II: Software Testing 15 Dr. Rabins Porwal Unit -II: Software Testing 16 Dr. Rabins Porwal
Unit -II: Software Testing 17 Dr. Rabins Porwal Unit -II: Software Testing 18 Dr. Rabins Porwal
Unit -II: Software Testing 19 Dr. Rabins Porwal Unit -II: Software Testing 20 Dr. Rabins Porwal
Unit -II: Software Testing 21 Dr. Rabins Porwal Unit -II: Software Testing 22 Dr. Rabins Porwal
Testing Testing
Software products are tested at Unit testing:
three levels: test the functionalities of a single module or
function.
Unit testing Integration testing:
Integration testing test the interfaces among the modules.
System testing:
System testing
test the fully integrated system against its functional
and non-functional requirements.
Unit -II: Software Testing 23 Dr. Rabins Porwal Unit -II: Software Testing 24 Dr. Rabins Porwal
Unit -II: Software Testing 25 Dr. Rabins Porwal Unit -II: Software Testing 26 Dr. Rabins Porwal
Unit -II: Software Testing 27 Dr. Rabins Porwal Unit -II: Software Testing 28 Dr. Rabins Porwal
Test Drivers & Test Stubs Test Drivers & Test Stubs
In order to test a single module, a complete
Modules required to provide
environment is needed to provide all that is necessary the necessary environment Driver module
for execution of the module. That is, besides the (which either call or are called
module under test, we will need the following in order by the module under test) are
to be able to test the module: usually not available until they, Module under
The procedure belonging to other modules that the too, have been unit tested; stubs test
Unit -II: Software Testing 29 Dr. Rabins Porwal Unit -II: Software Testing 30 Dr. Rabins Porwal
Unit -II: Software Testing 31 Dr. Rabins Porwal Unit -II: Software Testing 32 Dr. Rabins Porwal
Unit -II: Software Testing 33 Dr. Rabins Porwal Unit -II: Software Testing 34 Dr. Rabins Porwal
Unit -II: Software Testing 35 Dr. Rabins Porwal Unit -II: Software Testing 36 Dr. Rabins Porwal
Unit -II: Software Testing 37 Dr. Rabins Porwal Unit -II: Software Testing 38 Dr. Rabins Porwal
Unit -II: Software Testing 39 Dr. Rabins Porwal Unit -II: Software Testing 40 Dr. Rabins Porwal
Unit -II: Software Testing 41 Dr. Rabins Porwal Unit -II: Software Testing 42 Dr. Rabins Porwal
Unit -II: Software Testing 43 Dr. Rabins Porwal Unit -II: Software Testing 44 Dr. Rabins Porwal
Unit -II: Software Testing 45 Dr. Rabins Porwal Unit -II: Software Testing 46 Dr. Rabins Porwal
Unit -II: Software Testing 47 Dr. Rabins Porwal Unit -II: Software Testing 48 Dr. Rabins Porwal
Table 2: Decision table terminology Table 3: Decision table for triangle problem
Unit -II: Software Testing 49 Dr. Rabins Porwal Unit -II: Software Testing 50 Dr. Rabins Porwal
C5 : x = z ? -- -- -- T T F F T T F F
C6 : y = z ? -- -- -- T F T F T F T F
a1 : Not a triangle X X X
a2 : Scalene X
a3 : Isosceles X X X
a4 : Equilateral X
a5 : Impossible X X X
Unit -II: Software Testing 55 Dr. Rabins Porwal Unit -II: Software Testing 56 Dr. Rabins Porwal
Unit -II: Software Testing 57 Dr. Rabins Porwal Unit -II: Software Testing 58 Dr. Rabins Porwal
Fig. 10: Constraint symbols Fig. 11: Symbol for masks constraint
Unit -II: Software Testing 59 Dr. Rabins Porwal Unit -II: Software Testing 60 Dr. Rabins Porwal
Example 8.12
Consider the triangle problem specified in the example 8.3. Draw the Cause
effect graph and identify the test cases.
Unit -II: Software Testing 61 Dr. Rabins Porwal Unit -II: Software Testing 62 Dr. Rabins Porwal
Unit -II: Software Testing 65 Dr. Rabins Porwal Unit -II: Software Testing 66 Dr. Rabins Porwal
Unit -II: Software Testing 67 Dr. Rabins Porwal Unit -II: Software Testing 68 Dr. Rabins Porwal
Unit -II: Software Testing 69 Dr. Rabins Porwal Unit -II: Software Testing 70 Dr. Rabins Porwal
Unit -II: Software Testing 71 Dr. Rabins Porwal Unit -II: Software Testing 72 Dr. Rabins Porwal
Unit -II: Software Testing 73 Dr. Rabins Porwal Unit -II: Software Testing 74 Dr. Rabins Porwal
Unit -II: Software Testing 75 Dr. Rabins Porwal Unit -II: Software Testing 76 Dr. Rabins Porwal
Unit -II: Software Testing 77 Dr. Rabins Porwal Unit -II: Software Testing 78 Dr. Rabins Porwal
Unit -II: Software Testing 79 Dr. Rabins Porwal Unit -II: Software Testing 80 Dr. Rabins Porwal
Unit -II: Software Testing 81 Dr. Rabins Porwal Unit -II: Software Testing 82 Dr. Rabins Porwal
Unit -II: Software Testing 83 Dr. Rabins Porwal Unit -II: Software Testing 84 Dr. Rabins Porwal
Path coverage-
coverage-based
Linearly independent paths testing
Defined in terms of To understand the path coverage-based testing:
control flow graph (CFG) of a program. we need to learn how to draw control flow graph of
a program.
Unit -II: Software Testing 85 Dr. Rabins Porwal Unit -II: Software Testing 86 Dr. Rabins Porwal
Unit -II: Software Testing 87 Dr. Rabins Porwal Unit -II: Software Testing 88 Dr. Rabins Porwal
Unit -II: Software Testing 89 Dr. Rabins Porwal Unit -II: Software Testing 90 Dr. Rabins Porwal
Unit -II: Software Testing 91 Dr. Rabins Porwal Unit -II: Software Testing 92 Dr. Rabins Porwal
Unit -II: Software Testing 93 Dr. Rabins Porwal Unit -II: Software Testing 94 Dr. Rabins Porwal
Unit -II: Software Testing 95 Dr. Rabins Porwal Unit -II: Software Testing 96 Dr. Rabins Porwal
Unit -II: Software Testing 97 Dr. Rabins Porwal Unit -II: Software Testing 98 Dr. Rabins Porwal
Unit -II: Software Testing 99 Dr. Rabins Porwal Unit -II: Software Testing 100 Dr. Rabins Porwal
Unit -II: Software Testing 101 Dr. Rabins Porwal Unit -II: Software Testing 102 Dr. Rabins Porwal
Unit -II: Software Testing 103 Dr. Rabins Porwal Unit -II: Software Testing 104 Dr. Rabins Porwal
Unit -II: Software Testing 105 Dr. Rabins Porwal Unit -II: Software Testing 106 Dr. Rabins Porwal
Unit -II: Software Testing 107 Dr. Rabins Porwal Unit -II: Software Testing 108 Dr. Rabins Porwal
Unit -II: Software Testing 109 Dr. Rabins Porwal Unit -II: Software Testing 110 Dr. Rabins Porwal
Unit -II: Software Testing 111 Dr. Rabins Porwal Unit -II: Software Testing 112 Dr. Rabins Porwal
Unit -II: Software Testing 113 Dr. Rabins Porwal Unit -II: Software Testing 114 Dr. Rabins Porwal
Unit -II: Software Testing 115 Dr. Rabins Porwal Unit -II: Software Testing 116 Dr. Rabins Porwal
An interesting application of
Cyclomatic complexity
cyclomatic complexity
Cyclomatic complexity of a program:
Relationship exists between: also indicates the psychological complexity of a
McCabe's metric program.
the number of errors existing in the code, difficulty level of understanding the program.
the time required to find and correct the errors.
Unit -II: Software Testing 117 Dr. Rabins Porwal Unit -II: Software Testing 118 Dr. Rabins Porwal
Unit -II: Software Testing 119 Dr. Rabins Porwal Unit -II: Software Testing 120 Dr. Rabins Porwal
Data Flow-
Flow-Based Testing Data Flow-
Flow-Based Testing
For a statement numbered S, A variable x is said to be live at
DEF(S) = {x| statement S contains a definition of x}
USES(S)= {x| statement S contains a use of x} statement S1, if
Example: 1: a=b; DEF(1)={a}, USES(1)={b} x is defined at a statement S:
Example: 2: a=a+b; DEF(2) = {a}, there exists a path from S to S1 not
USES(2) = {a, b}
containing any definition of x.
Unit -II: Software Testing 121 Dr. Rabins Porwal Unit -II: Software Testing 122 Dr. Rabins Porwal
Unit -II: Software Testing 123 Dr. Rabins Porwal Unit -II: Software Testing 124 Dr. Rabins Porwal
Data Flow-
Flow-Based Testing Data Flow-
Flow-Based Testing
One simple data flow testing strategy: Data flow testing strategies:
every DU chain in a program be covered useful for selecting test paths of a
at least once. program containing nested if and loop
statements
Unit -II: Software Testing 125 Dr. Rabins Porwal Unit -II: Software Testing 126 Dr. Rabins Porwal
Unit -II: Software Testing 129 Dr. Rabins Porwal Unit -II: Software Testing 130 Dr. Rabins Porwal
Unit -II: Software Testing 131 Dr. Rabins Porwal Unit -II: Software Testing 132 Dr. Rabins Porwal
Unit -II: Software Testing 133 Dr. Rabins Porwal Unit -II: Software Testing 134 Dr. Rabins Porwal
Unit -II: Software Testing 135 Dr. Rabins Porwal Unit -II: Software Testing 136 Dr. Rabins Porwal
Unit -II: Software Testing 137 Dr. Rabins Porwal Unit -II: Software Testing 138 Dr. Rabins Porwal
Unit -II: Software Testing 139 Dr. Rabins Porwal Unit -II: Software Testing 140 Dr. Rabins Porwal
Unit -II: Software Testing 141 Dr. Rabins Porwal Unit -II: Software Testing 142 Dr. Rabins Porwal
Unit -II: Software Testing 143 Dr. Rabins Porwal Unit -II: Software Testing 144 Dr. Rabins Porwal
Unit -II: Software Testing 145 Dr. Rabins Porwal Unit -II: Software Testing 146 Dr. Rabins Porwal
Unit -II: Software Testing 147 Dr. Rabins Porwal Unit -II: Software Testing 148 Dr. Rabins Porwal
Unit -II: Software Testing 149 Dr. Rabins Porwal Unit -II: Software Testing 150 Dr. Rabins Porwal
Beta testing is the system testing: Acceptance testing is the system testing
performed by a select group of friendly performed by the customer
customers. to determine whether he should accept
the delivery of the system.
Unit -II: Software Testing 151 Dr. Rabins Porwal Unit -II: Software Testing 152 Dr. Rabins Porwal
Unit -II: Software Testing 153 Dr. Rabins Porwal Unit -II: Software Testing 154 Dr. Rabins Porwal
Unit -II: Software Testing 155 Dr. Rabins Porwal Unit -II: Software Testing 156 Dr. Rabins Porwal
Unit -II: Software Testing 157 Dr. Rabins Porwal Unit -II: Software Testing 158 Dr. Rabins Porwal
Unit -II: Software Testing 159 Dr. Rabins Porwal Unit -II: Software Testing 160 Dr. Rabins Porwal
Unit -II: Software Testing 161 Dr. Rabins Porwal Unit -II: Software Testing 162 Dr. Rabins Porwal
Compatibility testing
Compatibility Testing
Example
These tests are needed when the system If a system is to communicate with a
interfaces with other systems: large database system to retrieve
check whether the interface functions as information:
required. a compatibility test examines speed and
accuracy of retrieval.
Unit -II: Software Testing 163 Dr. Rabins Porwal Unit -II: Software Testing 164 Dr. Rabins Porwal
Unit -II: Software Testing 165 Dr. Rabins Porwal Unit -II: Software Testing 166 Dr. Rabins Porwal
Unit -II: Software Testing 167 Dr. Rabins Porwal Unit -II: Software Testing 168 Dr. Rabins Porwal
Unit -II: Software Testing 169 Dr. Rabins Porwal Unit -II: Software Testing 170 Dr. Rabins Porwal
Unit -II: Software Testing 171 Dr. Rabins Porwal Unit -II: Software Testing 172 Dr. Rabins Porwal
Unit -II: Software Testing 173 Dr. Rabins Porwal Unit -II: Software Testing 174 Dr. Rabins Porwal
Unit -II: Software Testing 175 Dr. Rabins Porwal Unit -II: Software Testing 176 Dr. Rabins Porwal
Unit -II: Software Testing 177 Dr. Rabins Porwal Unit -II: Software Testing 178 Dr. Rabins Porwal
Unit -II: Software Testing 179 Dr. Rabins Porwal Unit -II: Software Testing 180 Dr. Rabins Porwal
Unit -II: Software Testing 183 Dr. Rabins Porwal Unit -II: Software Testing 184 Dr. Rabins Porwal
Unit -II: Software Testing 185 Dr. Rabins Porwal Unit -II: Software Testing 186 Dr. Rabins Porwal
Representative Coding
Representative Coding Guidelines
Standards
Error return conventions and exception Do not use too clever and difficult to
handling mechanisms. understand coding style.
the way error and exception conditions are Code should be easy to understand.
handled should be standard within an
organization. Many inexperienced engineers actually take
For example, when different functions pride:
encounter error conditions in writing cryptic and incomprehensible code.
should either return a 0 or 1 consistently.
Unit -II: Software Testing 187 Dr. Rabins Porwal Unit -II: Software Testing 188 Dr. Rabins Porwal
Unit -II: Software Testing 189 Dr. Rabins Porwal Unit -II: Software Testing 190 Dr. Rabins Porwal
Obscure side effects make it difficult to Do not use an identifier (variable name)
understand a piece of code. for multiple purposes.
For example, Programmers often use the same identifier
for multiple purposes.
if a global variable is changed obscurely in a
called module, For example, some programmers use a
temporary loop variable
it becomes difficult for anybody trying to
also for storing the final result.
understand the code.
Unit -II: Software Testing 191 Dr. Rabins Porwal Unit -II: Software Testing 192 Dr. Rabins Porwal
Unit -II: Software Testing 193 Dr. Rabins Porwal Unit -II: Software Testing 194 Dr. Rabins Porwal
Unit -II: Software Testing 195 Dr. Rabins Porwal Unit -II: Software Testing 196 Dr. Rabins Porwal
Unit -II: Software Testing 197 Dr. Rabins Porwal Unit -II: Software Testing 198 Dr. Rabins Porwal
Unit -II: Software Testing 199 Dr. Rabins Porwal Unit -II: Software Testing 200 Dr. Rabins Porwal
Unit -II: Software Testing 201 Dr. Rabins Porwal Unit -II: Software Testing 202 Dr. Rabins Porwal
Unit -II: Software Testing 203 Dr. Rabins Porwal Unit -II: Software Testing 204 Dr. Rabins Porwal
Unit -II: Software Testing 205 Dr. Rabins Porwal Unit -II: Software Testing 206 Dr. Rabins Porwal
Unit -II: Software Testing 207 Dr. Rabins Porwal Unit -II: Software Testing 208 Dr. Rabins Porwal
Unit -II: Software Testing 209 Dr. Rabins Porwal Unit -II: Software Testing 210 Dr. Rabins Porwal
Unit -II: Software Testing 211 Dr. Rabins Porwal Unit -II: Software Testing 212 Dr. Rabins Porwal
Unit -II: Software Testing 213 Dr. Rabins Porwal Unit -II: Software Testing 214 Dr. Rabins Porwal
Unit -II: Software Testing 215 Dr. Rabins Porwal Unit -II: Software Testing 216 Dr. Rabins Porwal
Unit -II: Software Testing 217 Dr. Rabins Porwal Unit -II: Software Testing 218 Dr. Rabins Porwal
External Documentation
Unless all documents are consistent with each
other,
a lot of confusion is created for somebody trying to
understand the product.
All the documents for a product should be up-to-
date:
Even a few out-of-date documents can create severe
confusion.