Chapter 4
Chapter 4
Chapter 4
Methods
Contents:
Software Testing Strategies And Methods
4.1 Software Testing Fundamentals
Definition of Software Testing
Concept of - Good Test, Successful Test, Testing strategies,
Test Plan, Test Cases, Test Data.
4.2 Characteristics of Testing Strategies
4.3 Software Verification and Validation (V&V) - Concept and
difference between these two.
4.4 Testing Strategies
Unit Testing Integration Testing
Top-Down Approach Bottom-up Approach
Regression Testing Smoke Testing
4.5 Alpha and Beta Testing ( Concept and differences)
4.8 Debugging
Concept and need of Debugging
Characterstics of bugs
Test plan:
• A s/w test plan is a document that contains the strategy
that will be used to verify as well as make sure that s/w
product adheres to its design specifications & other
requirements.
• Validation Testing
• Integration Testing
• Unit Testing
• Code
• Design
• Requirements
• System Engineering
• In the beginning requirement analysis takes place. After that
there is s/w design. After design phase the actual development
that is coding takes place.
• Unit testing begins at the vertex of the spiral model & focuses or
works on each unit of the s/w program known as source code.
• In system testing the s/w & other system elements are tested as
a whole unit.
s/w testing steps
• Unit testing:
• Focuses on each component individually.
• Make sure that every unit functions properly.
• Integration testing:
• Focuses on issues related to construction & verification.
• Test case design techniques that focus on input&
output are very common during integration.
• High order tests:
• For purpose of integration testing
• Validation testing:
• It checks whether s/w satisfies all performance ,
functional & behavioral needs.
Unit Testing
module
to be
tested
results
software interface
engineer
local data structures
boundary conditions
independent paths
error handling paths
test cases
26
• Unit testing is all about verification efforts that are
taken on smallest unit of s/w.
• The smallest unit of design could be module.
• Aspect of program testing are
• Local data structures(local variables ):
Checked to make sure that data stored in temporary
manner maintains its integrity while execution.
• All independent paths are checked & are exercised
through control structure to make sure that every
statement in a module is at least executed for once.
• Boundary conditions(array):
Tested to make sure that the module works or
operates within boundaries that are established
Unit Test Environment
driver
interface
local data structures
stub stub
test cases
RESULTS 28
Unit test procedure:
The design of unit tests can be performed before coding
begins/after source code has been generated.
• Driver
– A simple main program that accepts test case data,
passes such data to the component being tested, and
prints the returned results
• Stubs
– Serve to replace modules that are subordinate to (called
by) the component to be tested
– It uses the module’s exact interface, may do minimal data
manipulation, provides verification of entry, and returns
control to the module undergoing testing
• Drivers and stubs both represent overhead
– Both must be written but don’t constitute part of the
installed software product 29
Integration Testing
• Defined as a systematic technique for
constructing the software architecture
– At the same time integration is occurring, conduct
tests to uncover errors associated with interfaces
• Objective is to take unit tested modules and
build a program structure based on the
prescribed design
• Two Approaches
– Non-incremental Integration Testing
– Incremental Integration Testing
30
Non-incremental
Integration Testing
requirements
output
40
Debugging Process
• Debugging occurs as a consequence of successful testing
• It is still very much an art rather than a science
• Good debugging ability may be an innate human trait
• Large variances in debugging ability exist
• The debugging process begins with the execution of a
test case
• Results are assessed and the difference between
expected and actual performance is encountered
• This difference is a symptom of an underlying cause that
lies hidden
• The debugging process attempts to match symptom with
cause, thereby leading to error correction
41
Why is Debugging so Difficult?
• The symptom and the cause may be
geographically remote
• The symptom may disappear (temporarily) when
another error is corrected
• The symptom may actually be caused by
nonerrors (e.g., round-off accuracies)
• The symptom may be caused by human error that
is not easily traced
(continued on next slide)
42
Why is Debugging so Difficult?
(continued)
45
Strategy #2: Backtracking
• Can be used successfully in small programs
• The method starts at the location where a symptom
has been uncovered
• The source code is then traced backward (manually)
until the location of the cause is found
• In large programs, the number of potential backward
paths may become unmanageably large
46
Strategy #3: Cause Elimination
• Involves the use of induction or deduction and introduces the
concept of binary partitioning
– Induction (specific to general): Prove that a specific starting
value is true; then prove the general case is true
– Deduction (general to specific): Show that a specific
conclusion follows from a set of general premises
• Data related to the error occurrence are organized to isolate
potential causes
• A cause hypothesis is devised, and the aforementioned data
are used to prove or disprove the hypothesis
• Alternatively, a list of all possible causes is developed, and tests
are conducted to eliminate each cause
• If initial tests indicate that a particular cause hypothesis shows
promise, data are refined in an attempt to isolate the bug
47