Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 61

UNIT-5

SOFTWARE TESTING STRATEGIES


Today’s Session: Outlines
• Objective
• A Strategic Approach to Software Testing
• Testing Strategies – Generic Characteristics
• Testing Vs Debugging
• Verification and Validation
• Organizing for Software Testing
• Software Testing Steps

SOFTWARE ENGINEERING
SOFTWARE TESTING STRATEGIES
• Objective

• The main objective of software testing is to design


the tests in such a way that it systematically finds
different types of errors without taking much time and
effort so that less time is required for the development
of the software.

SOFTWARE ENGINEERING
SOFTWARE TESTING - Terminologies

SOFTWARE ENGINEERING
SOFTWARE TESTING STRATEGIES
• What is Testing?
• Step-1:Example: some software under test.

• Step-2: When we're doing testing, we always require a source of


test inputs which result in test outputs.

• Step-3: The outputs are processed by an acceptability check.

• Step-4: If the outputs are okay, then the test case succeeded.

• Step-5: If the outputs are not okay, then the test case failed and
we're going to have to debug.
SOFTWARE ENGINEERING
SOFTWARE TESTING STRATEGIES
• What is Testing?

SOFTWARE ENGINEERING
A Strategic Approach to Software Testing
• Testing is a set of activities that can be planned in
advance and conducted systematically

• For a software process a set of test case design


techniques and testing methods are defined

• A number of testing methods are proposed

SOFTWARE ENGINEERING
Testing Strategies – Generic Characteristics
• To perform effective testing a software team should
conduct effective formal technical reviews.

• Testing begins at the component level and works


outward toward the integration of the entire computer
based system

• Testing is conducted by the developer of the software


and for large projects an independent test group

SOFTWARE ENGINEERING
TESTING DEBUGGING
Testing is the process of executing Debugging is the process of
software with intent to find or detecting and correcting errors
detect bugs
Error Detection is the goal of Error Detection and Correction is
testing the goal of debugging
Testing starts with known Debugging starts with unknown
conditions conditions
The output is predictable The output is unpredictable
Testing proves a programmer's Debugging is the programmer's
failure vindication(Justification).
Much testing can be done without Debugging is impossible without
. design knowledge detailed design Knowledge
Testing can often be done by an Debugging must be done by an
outsider insider
Much of test execution and design Debugging is still a dream.
Can be automated
SOFTWARE ENGINEERING
Verification and Validation
• Verification
• is the process of checking that the software meets
specifications

• The verifying process includes checking documents,


design, code, and program.

SOFTWARE ENGINEERING
Verification and Validation
• Validation is the process of checking whether the
specification captures the customer's requirements

• Validation
• is a dynamic mechanism of Software testing and
validates the actual product.

SOFTWARE ENGINEERING
Verification and Validation

SOFTWARE ENGINEERING
Organizing for Software Testing
• Software Testing Strategy:

SOFTWARE ENGINEERING
Software Testing Steps
Testing Strategy
Software Testing

white- black-
box box
methods
methods

Methods

Strategies
White-box testing
• White-box testing is a method of software testing that tests
internal structures or workings of an application, as opposed to
its functionality.
• In white-box testing, an internal perspective of the system is
used to design test cases.
White-box testing
Black-box testing
• Black-box testing is a method of software testing that
examines the functionality of an application without
peering into its internal structures or workings.
• The advantages of black box testing include
its simplicity and independence from technical
aspects, making it accessible to testers with varying
levels of technical knowledge.
• It also allows for early detection of functional issues,
as it can be executed before the development team
completes the implementation details.
Black-box testing
Black Box Vs White Box Testing
Black Box Testing White Box Testing

The Black Box Test is a test that only


considers the external behavior of the The White Box Test is a method used to
system; the internal workings of the test a software taking into consideration
software is not taken into account. its internal functioning.

It is carried out by testers. It is carried out by software developers.

This method is used in System Testing or This method is used in


Acceptance Testing. Unit Testing or Integration Testing.
It is the least time consuming. It is most time consuming.
It is the behavior testing of the software. It is the logic testing of the software.

It is also known as data-driven testing, It is also known as clear box testing, code-
based testing, structural testing, and
functional testing, and closed box testing. transparent testing.

Black Box Test is not considered for White Box Test is well suitable for
algorithm testing. algorithm testing.
Black Box Vs White Box Testing
The Art of Debugging Process
Definition: Debugging is
the process of detecting and
removing of existing and
potential errors
The Art of Debugging Process
• The debugging process begins with the execution of
a test case
• The results are assessed and a lack of
correspondence between expected and actual
performance is encountered
• Debugging attempts to match symptom with there
by leading to error correction
• Debugging will always have one of two outcomes
(i) The cause will be found and corrected
(ii) The cause will not be found
Why is debugging so difficult?
• (1) The symptom and the cause may be geographically remote [i.e. the symptom may
appear in one part of a program, while the cause may actually be located at a site that is
far moved]

• (2) The symptom may disappear [temporarily] when another error is corrected

• (3) The symptom may actually be caused by non errors [e.g. round off inaccuracies]

• (4) The symptom may be caused by human error that is not easily traced

• (5) The symptom may be a result of timing problems rather than processing problems

• (6) It may be difficult to accurately reproduce input conditions [e.g. a real time
application in which input ordering is indeterminate] not exactly defined, not known..

• (7) The symptom may be intermittent. This is particularly common in embedded systems
that couple hardware and software inextricable (not possible to separate)

• (8) The symptom may be due to causes that are distributed across a number of tasks
running on different processors
Strategies for Conventional Software Testing
• Unit Testing
– Unit Testing Environment
• Integration Testing
– Top Down Integration
– Bottom Up Integration
• Regression Testing
Unit Testing

module
to be
tested

results

software
engineer
test cases

• Test Case: is a set of conditions under which a tester will


determine whether an application, software system or one of its
features is working as it was originally established for it to do.
Unit Testing

module
to be
tested

interface
local data structures
boundary conditions
independent paths
error handling paths

test cases
Unit Test Environment

Stubs are the modules that act as temporary replacement for a


called module and give the same output as that of the actual product.
Integration Testing
• Top Down Integration
• Depth First Integration
• Breadth First integration
• Bottom-up Integration G
Top Down Integration

A
top module is tested with
stubs

B F G

stubs are replaced one at


a time, "depth first"
C
as new modules are integrated,
some subset of tests is re-run
D E
Top Down Integration
• This testing is an incremental approach to construction of the software
architecture
• The modules are integrated by moving downward through the control hierarchy
begin with main control module [Main program]
• The subordinate module to main control module are integrated either in a Depth
first (Or) Breadth first manner
Top Down Integration
• Depth First Integration:
• * It integrates all components on a major control path of the program structure
• * Selection of major path depends on application specific characteristics
• * For example, selecting the left hand path components M1, M2, M5 would be integrated
first and next M8
• * Then the central and right hand control paths are built

• Breadth First integration:


• It incorporates all components
directly subordinate at each level,
moving tree structure horizontally
• In the above figure components M2, M3 and M4
would be Integrated first and next M5, M6
and so on..
Bottom-Up Integration

B F G

drivers are replaced one at a


time, "depth first"
C

worker modules are grouped into


builds and integrated
D E
cluster
Bottom-Up Integration
Steps followed in the Bottom – Up Integration:

Step 1: Low level components are combined into Clusters [also called builds] that perform a specific software function

Step 2: A driver [a control program for testing] is written to coordinate test case input and output

Step 3: The cluster is tested

Step 4: Drivers are removed and Clusters are combined moving upward in the program structure
Regression Testing
• Regression testing is the re-execution of some subset of tests that have
already been conducted to ensure that changes have not propagated
unintended side effects

• Regression Testing is a Software Testing type in which test cases are re-executed in
order to check whether the previous functionality of the application is working fine
and the new changes have not introduced any new bugs.

• When to Perform Regression Testing?

• Regression tests are frequently executed throughout the "software testing life
cycle" at each different level; "unit", "integration", "system" and "acceptance".

• Steps to Conduct Regression Testing?


 A basic approach to carry out regression testing comprises of following
actions:
 Re-execution of already conducted tests.
 Comparison of older test and fresh test results.
Testing Techniques
 White Box Testing or Glass Box Testing
 Basis Path Testing
 Flow Graph Notation
 Independent Program Paths, Cyclomatic Complexity
 Deriving Test Cases
 Graph Matrices
 Control Structure Testing
 Condition Testing
 Data Flow Testing
 Loop Testing
 Black Box Testing or Behavioral Testing
 Graph-Based Testing Methods
 Equivalence Partitioning
 Boundary Value Testing
Path Testing:
• o Path Testing is the name given to a family of test techniques based on
• judiciously selecting a set of test paths through the program.
• o If the set of paths are properly chosen then we have achieved some
measure
• of test thoroughness. For example, pick enough paths to assure that every
• source statement has been executed at least once.
• o Path testing techniques are the oldest of all structural test techniques.
• o Path testing is most applicable to new software for unit testing. It is a
• structural technique.
• o It requires complete knowledge of the program's structure.
• o It is most often used by programmers to unit test their own code.
• o The effectiveness of path testing rapidly deteriorates as the size of the
• software aggregate under test increases.
one to one flow chart
representation
Basis Path Testing

Path Testing is a method that is used to design the test cases. In path
testing method, the control flow graph of a program is designed to
find a set of linearly independent paths of execution.

Flow Graph Testing: Logical flow of the Program is called control flow
graph
Flow Chart and Flow Graph
Independent Program Paths
Independent Program Paths

An Independent path is any path through the program that


introduces at lest one new set of processing statements or a
new condition.
Graph Matrices with example
Independent Program Paths
 Cyclomatic Complexity:
is computed one of three ways
1. The Number of regions of the graph
V(G)=R
2. Cylomatic complexity V(G) for a flow graph G is defined as

V(G)=E-N+2
3. Cylomatic complexity V(G) for a flow graph G is defined as
V(G)=P+1 where P is the Predicate Node in flow graph
Graph Matrices:

Find the following:


Cyclomatic Complexity
No. of Paths
Graph Matrices
SOFTWARE ENGINEERING
Assignment on White Box Testing
2. Calculate the Cyclomatic complexity :

SOFTWARE ENGINEERING
Control Structure Testing
 Control Structure Testing
 Condition Testing
 Data Flow Testing
 Loop Testing

SOFTWARE ENGINEERING
Condition Testing
• Condition testing method that exercises the logical conditions
contained in a program module.
• A simple condition is a Boolean variable ora relational
expression, possibly preceded with one NOT (¬) operator.
• A relational expression takes the form E1 <relational-operator>
E2
• A compound condition is composed oftwo or more simple
conditions, Boolean operators, and parentheses
• If a condition is incorrect, then at least one component of the
condition is incorrect.
• Therefore, types of errors in a condition include Boolean
operator errors Boolean variable errors, Boolean parenthesis
errors, relational operator errors, and arithmetic expression errors
Data Flow Testing
• Data flow testing is a white-box testing
technique that examines the data flow with
respect to the variables used in the code
• Data Flow Testing uses the control flow graph
to find the situations that can interrupt the
flow of the program.
Loop Testing
• Loop testing is a white-box testing technique
that focuses exclusively on the validity of loop
constructs.
• Four different classes of loops can be defined:
simple loops, concatenated loops, nested
loops, and unstructured loops
Simple loops.
• The following set of tests can be applied to
simple loops where n is the maximum number
of allowable passes through the loop.
• 1. Skip the loop entirely.
• 2. Only one pass through the loop.
• 3. Two passes through the loop
• 4. m passes through the loop where m < n.
• 5. n -1, n, n + 1 passes through the loop.
Nested Loop
• 1. Start at the innermost loop. Set all other loops to
minimum values.
• 2. Conduct simple loop tests for the innermost loop
while holding the outerloops at their minimum
iteration parameter (e.g., loop counter) values.
• Addother tests for out-of-range or excluded values.
• 3. Work outward, conducting tests for the next loop,
but keeping all other outerloops at minimum values
and other nested loops to “typical” values.
• 4. Continue until all loops have been tested
• Concatenated loops. Concatenated loops can be
tested using the approach defined for simple loops,
if each of the loops is independent of the other.
• if two loops are concatenated and the loop counter
for loop 1 is used as the initial value for loop 2,
then the loops are not independent.
• When the loops are not independent, the
approach applied to nested loops is recommended.
• Unstructured loops. Whenever possible, this class
of loops should be redesigned to reflect the use of
the structured programming constructs
Example: Find the Values

Cyclomatic Complexity:
1. V(G)=R =3
2. V(G)=E-N+2 = 8-7+2 = 3
3. V(G)=P+1 = 2+1 = 3

Graph Matrices

SOFTWARE ENGINEERING
Example:

Cyclomatic Complexity:
1. V(G)=R
2. V(G)=E-N+2
3. V(G)=P+1
Graph Matrices

SOFTWARE ENGINEERING
Example:

Cyclomatic Complexity:
1. V(G)=R = 4
2. V(G)=E-N+2 = 9-7+2 = 4
3. V(G)=P+1 = 3+1 = 4
Graph Matrices

SOFTWARE ENGINEERING
Example:

Cyclomatic Complexity:
1. V(G)=R
2. V(G)=E-N+2
3. V(G)=P+1

SOFTWARE ENGINEERING

You might also like