Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

03/04/2020

Lecture 4
 Software Testing Technique

SK Alamgir Hossain
Associate Professor
CSE Discipline, Khulna University

Testability
 Software testability is simply how easily [a computer program] can
be tested.
 Operability—It operates cleanly
 Observability—The results of each test case are readily observed
 Controllability—The better we can control the software, the more the testing
can be automated and optimized.
 Decomposability— Software modules can be tested independently.
 Simplicity—Reduce complex architecture and logic to simplify tests
 Stability—Few changes are requested during testing
 Understandability—The more information we have, the smarter we will test.

1
03/04/2020

What is a “Good” Test?


 A good test has a high probability of finding an error
 A good test is not redundant.
 Testing time and resources are limited. There is no point in
conducting a test that has the same purpose as another test.
 A good test should be neither too simple nor too complex

Exhaustive Testing

loop < 20 X

14
There are 10 possible paths! If we execute one
test per millisecond, it would take 3,170 years to
test this program!!

2
03/04/2020

Selective Testing

Selected path

loop < 20 X

Software Testing

white-box black-box
methods methods

Methods

Strategies

3
03/04/2020

White-Box Testing

... our goal is to ensure that all


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

Basic Path Testing


 Basis path testing is a white-box testing technique
 that 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 notation

4
03/04/2020

Basic Path Testing: Flowchart, (A) and flow graph (B)

A B

Basic Path Testing: Cyclomatic Complexity

 Cyclometic complexity is a software metric used to


measure the complexity of a program.
 Structural complexity
 Computed
• The number of regions corresponds to the CC
• V(G) = e – n + 2p
• V(G) = P + 1
 e = edge
 n = node
 P = predicate node (nodes that have conditions)
 p = No of node that have exit point

10

5
03/04/2020

Basic Path Testing: Basis Path Testing

1
Next, we derive the
independent paths:

2 Since V(G) = 4,
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
Finally, we derive test
7 cases to exercise these
paths.

11

Loop Testing
 Loop testing is a white-box testing technique that focuses exclusively on the
validity of loop constructs.

12

6
03/04/2020

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 the loop

where n is the maximum number of allowable passes

13

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. Continue this step until
the outermost loop has been tested.
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.

14

7
03/04/2020

Black-Box Testing
 Black-box testing, also called behavioral testing

requirements

output

input events

15

Any Question?

16

You might also like