SE - Ch.10 - Software Testing
SE - Ch.10 - Software Testing
COURSE NAME
SOFTWARE TESTING
SOFTWARE
SOFTWARE
ENGINEERING
ENGINEERING
(UNDERGRADUATE
CSC 3114
)
(UNDERGRADUATE
)
SAIKAT BAUL
LECTURER, CS, AIUB
[email protected]
Slide-2
SOFTWARE TESTING
Testing is the process of exercising a program with the specific intent of
finding errors
prior to delivery to the end user
Software testability is simply how easily [a computer program] can be
tested
Testing Shows
Error
Requirements Conformance
Performance
An indication of quality
SB
Slide-3
WHO TESTS THE SOFTWARE?
Developer
Understands the system but, will test "gently“ and, is driven by
"delivery“
Experiencing the software operation (known to the developer)
Independent tester
Must learn about the system, but, will attempt to break it and, is driven
by “quality”
Exploring the software operation (unknown to the tester)
SB
Slide-4
V&V
Validation refers to a different set of tasks that ensure that the software
that has been built is traceable to customer requirements.
Verification refers to the set of tasks that ensure that software correctly
implements a specific function/process.
Boehm states this another way:
Validation: "Are we building the right product?“
Verification: "Are we building the product right?"
SB
Slide-5
TESTING STRATEGY
SB
Slide-6
TESTING STRATEGY
SB
Slide-7
TESTING STRATEGIC ISSUES
Specify product requirements in a quantifiable manner long before testing
commences
State testing objectives explicitly
Understand the users of the software and develop a profile for each user
category
Develop a testing plan that emphasizes “rapid cycle testing”
Build “robust” software that is designed to test itself
Use effective technical reviews as a filter prior to testing; many errors will
be eliminated before testing begins
Conduct technical reviews to assess the test strategy and test cases
themselves
Develop a continuous improvement approach for the testing process
SB
Slide-8
UNIT TESTING
Tests a small software unit at a time, which is typically performed by the individual
programmer who implemented the unit prior to Integration testing
SB
10
Slide-
TOP-DOWN INTEGRATION
top module is
tested with stubs
down to the bottom
Fig.1
SB
11
Slide-
BOTTOM-UP INTEGRATION
SB
13
Slide-
SMOKE TESTING
Smoke testing steps:
Software components that have been translated into code are integrated into a
“daily build”
- A build includes all data files, libraries, reusable modules, and engineered
components that are required to implement one or more product functions.
A series of tests is designed to expose errors that will keep the build from properly
performing
its function.
- The intent should be to uncover “show stopper” errors that have the highest
likelihood of throwing the software project behind schedule.
The build is integrated with other builds and the entire product (in its current form is
smoke tested daily.
- The integration approach may be top down or bottom up.
SB
14
Slide-
OBJECT-ORIENTED TESTING
Class testing is the equivalent of unit testing
Operations within the class are tested
The state behavior of the class is examined
SB
15
Slide-
System testing: focus is on system integration (e.g. hardware integration, OS
compatibility)
HIGHER ORDER TESTING
Alpha/Beta testing: Alpha testing is simulated or actual operational testing by
potential users
or an independent test team at the developers' site. Alpha testing is often
employed for off-the-shelf software as a form of internal acceptance testing, before
the software goes to beta testing by users
Recovery testing: forces the software to fail in a variety of ways and verifies that
recovery
is properly performed
Security testing: verifies that protection mechanisms built into a system will, in
fact, protect it
from improper penetration
Stress testing: executes a system in a manner that demands resources in
abnormal quantity,
frequency, or volume
Performance Testing: test the run-time performance of software within the
SB
16
Slide-
DEBUGGING
SB
17
Slide-
DEBUGGING TECHNIQUES
Brute force testing
most common; but least efficient
memory dumps are taken, run-time traces are invoked, and the program is
loaded with output statements (Dynamic Testing)
Backtracking
common debugging approach that can be used successfully in small programs
source code is traced backward (manually) until the cause is found
Cause elimination
a “cause hypothesis” is devised
if initial tests indicate that a particular cause hypothesis shows promise, data are
refined in an attempt to isolate the bug (c/a-b where the possibility of a-b is zero)
SB
18
Slide-
BASIS-PATH TESTING
The basis path method enables the test-case designer to derive a logical
complexity measure of a procedural design and use this measure as a
guide for defining a basis set
of execution paths Flow Graph
McCabe views a program
as a directed graph in which
lines of program statements
are represented by nodes and
the flow of control between the
statements is represented
by the edges
SB
19
Slide-
INDEPENDENT PROGRAM PATHS
Path 1: 1-11
Path 2: 1-2-3-4-5-10-1-11
Path 3: 1-2-3-6-8-9-10-1-11
Path 4: 1-2-3-6-7-9-10-1-11
Note that each new path introduces a new edge.
The path 1-2-3-4-5-10-1-2-3-6-8-9-10-1-11 is not
considered to be an independent path because
it is simply a combination of already specified
paths and does not traverse any new edges.
How do you know how many paths to look for?
The computation of cyclomatic complexity
provides the answer
SB
20
Slide-
CYCLOMATIC COMPLEXITY
Cyclomatic complexity is a software metric that provides a quantitative measure of
the logical complexity of a program. Complexity is computed in one of three ways:
1. The number of independent paths
2. The number of regions of the flow graph corresponds to the cyclomatic
complexity.
(in the previous example = 4)
3. Cyclomatic complexity V(G) for a flow graph G is defined as V(G) = E - N + 2
(in the previous example 11 -9 + 2 = 4)
where E is the number of flow graph edges and N is the number of flow graph
nodes.
4. Cyclomatic complexity V(G) for a flow graph G is also defined as V(G) = P + 1
(in the previous example 3 + 1 = 4) [condition: 1; 2,3; 6]
where P is the number of predicate nodes (containing a condition) contained in
the flow graph G SB
21
Slide-
WHITE-BOX TESTING
Using white-box testing methods, you can derive test cases that
(1) guarantee that all independent paths within a module have been
exercised at least once,
(2) exercise all logical decisions on their true and false sides,
(3) execute all loops at their boundaries and within their operational
bounds, and
(4) exercise internal data structures to ensure their validity.
SB
22
Slide-
BLACK-BOX TESTING
SB
Slide - 23
REFERENCES
SB