0% found this document useful (0 votes)
6 views

Lecture 13

The document discusses software testing techniques, focusing on white-box and black-box methods. It outlines various strategies such as path testing, loop testing, and equivalence partitioning, emphasizing the importance of testing both internal logic and external functionality. Additionally, it highlights the significance of boundary value analysis and other black-box techniques to improve testing efficiency and error detection.

Uploaded by

uxamach7562
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lecture 13

The document discusses software testing techniques, focusing on white-box and black-box methods. It outlines various strategies such as path testing, loop testing, and equivalence partitioning, emphasizing the importance of testing both internal logic and external functionality. Additionally, it highlights the significance of boundary value analysis and other black-box techniques to improve testing efficiency and error detection.

Uploaded by

uxamach7562
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Software Engineering

Lecture 13

Software Testing Techniques

1
Software Testing
Software testing comes in many flavors for testing one method
or program

white-box black-box
methods methods

Methods

Strategies

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
2
White-Box Testing

... our goal is to ensure that all


statements and conditions have
been executed at least once ...

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
3
Why Cover?

logic errors and incorrect assumptions


are inversely proportional to a path's
execution probability

we often believe that a path is not


likely to be executed; in fact, reality is
often counter intuitive

typographical errors are random; it's


likely that untested paths will contain
some

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
4
Basic Path Testing
Next, we derive the
independent paths:
1

2 There are four paths

3 Path 1: 1,2,3,6,7,8
4
5 6
Path 2: 1,2,3,5,7,8
Path 3: 1,2,4,7,8
Path 4: 1,2,4,7,2,4,...7,8
7
Finally, we derive test
cases to exercise these
8
paths.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
5
Loop Testing

Simple
loop
Nested
Loops
Concatenated
Loops Unstructured
Loops
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
6
Loop Testing: Simple Loops

Minimum conditions—Simple Loops


1. skip the loop entirely
2. only one pass through the loop
3. two passes through the loop
4. m passes through the loop m < n
5. (n-1), n, and (n+1) passes through Simple
the loop loop

where n is the maximum number


of allowable passes

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
7
Loop Testing: Nested Loops
Nested Loops
Start at the innermost loop.
Set all outer loops to their minimum iteration parameter
values.
Test the min+1, typical, max-1 and max for the
innermost loop, while holding the outer loops at their
minimum values.

Move out one loop and set it up as in step 2, holding all


other loops at typical values. Nested
Loops
Continue this step until the outermost loop has been
tested.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
8
Loop Testing: Concatenated Loops

Concatenated Loops

If the loops are independent of one another


then treat each as a simple loop
else* treat as nested loops
endif*
for example, the final loop counter value
of loop 1 is used to initialize loop 2.

Concatenated
Loops
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
9
White Box Testing

White box testing techniques analyze the


internal structures, the used data structures,
internal design, code structure, and the
working of the software rather than just the
functionality as in black box testing.
White box testing is also known as structural
testing or code-based testing, and it is used
to test the software’s internal logic, flow, and
structure.
The tester creates test cases to examine the
code paths and logic flows to ensure they
meet the specified requirements.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
10
What Does White Box Testing Focus On?

 Path Checking: Examines the different routes the


program can take when it runs. Ensures that all
decisions made by the program are correct, necessary,
and efficient.
 Output Validation: Tests different inputs to see if the
function gives the right output each time.
 Loop Testing: Checks the loops in the program to
make sure they work correctly and efficiently. Ensures
that loops handle variables properly within their scope.
 Data Flow Testing: Follows the path of variables
through the program to ensure they are declared,
initialized, used, and manipulated correctly.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
11
Types of White Box Testing

White box testing can be done for different


purposes. The three main types are:

 Unit Testing
 Integration Testing
 Regression Testing

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
12
Black-Box Testing

requirements

output

input events

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
13
Black Box Testing is an important part of
making sure software works as it should.
Instead of exploring the code, testers check
how the software behaves from the outside,
just like users would. This helps catch any
issues or bugs that might affect how the
software works.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
14
Types of Black Box Testing

The following are the various categories of


black box testing:

Functional Testing
Regression Testing
Nonfunctional Testing (NFT)

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
15
Equivalence Partitioning
It is often seen that many types of inputs
work similarly so instead of giving all of them
separately we can group them and test only
one input of each group.
The idea is to partition the input domain of the
system into several equivalence classes such
that each member of the class works
similarly.
If a test case in one class results in some
error, other members of the class would also
result in the same error.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
16
Equivalence Partitioning

user output FK
queries mouse formats input
data
picks prompts

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
17
Equivalence Partitioning

Invalid inputs Valid inputs

System

Outputs
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
18
Equivalence Partitioning
Partition system inputs and outputs into
‘equivalence sets’
 If input is a 5-digit integer between 10,000 and 99,999,
equivalence partitions are <10,000, 10,000-99, 999 and > 99,999

Choose test cases from these sets

 00000, 09999, 10000, 99999, 100001

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
19
Example
Let us consider an example of any college
admission process. There is a college that
gives admissions to students based upon
their percentage.

Consider percentage field that will accept


percentage only between 50 to 90 %, more
and even less than not be accepted, and
application will redirect user to an error page.
If percentage entered by user is less than 50
%or more than 90 %, that equivalence
partitioning method will show an invalid
percentage. If percentage entered is between
50 to 90 %, then equivalence partitioning
method will show valid percentage.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
20
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
21
Boundary Value Analysis

Boundaries are very good places for errors to


occur.
Hence, if test cases are designed for
boundary values of the input domain then the
efficiency of testing improves and the
probability of finding errors also increases.
For example – If the valid range is 10 to 100
then test for 10,100 also apart from valid and
invalid inputs.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
22
Boundary Value Analysis

user output FK
queries mouse formats input
data
picks prompts

output
input domain domain
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
23
Example

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
24
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
25
Other Black Box Techniques

error guessing methods


decision table techniques
cause effect graphing

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
26
End of Lecture

27

You might also like