Download Testing-Aeronautical Engineering And Computer Programming-Lecture Slides and more Slides Aeronautical Engineering in PDF only on Docsity!
3
Testing
- Testing is a process of executing a software program with the intention of finding a error
- is one that has a high probability of finding an as-yet undiscovered error
- test is one that uncovers an as-yet undiscovered error” (Glen Myers, “The art of software testing” )
- systematically uncover different classes of errors
4
Test Techniques 1
used to measure the adequacy of a set
of test cases:
coverage of the product to be tested
the adequacy
of the typical errors that people make
Primary objectives
A good test case
A successful
Secondary Objectives Design tests that
Do so with a minimum of time and effort Provide reliable indications of software quality
• Classified according to the criterion
- Testing requirements are specified in terms of the
- Fault detecting ability of the test set determines
- Focus on error-prone points, based on knowledge
5
(Definitions)
• Error
result
• Fault
fault. A fault thus is the manifestion of an error
• Failure
are
failures
6
PRS
Exception handling is used to capture:
- Error is a human action that produces an incorrect
- Consequence of an error is software containing a
- If encountered, a fault may result in a failure
• What we observe during testing
1. Errors
2. Faults
3. Failures
4. I am still sleeping …
Inputs causing anomalous behaviour
Outputs which reveal the presence of defects
9
Black-Box Testing
I e
O (^) e
System
Inputs causing
behavior
Outputs which reveal
I
O
10
Equivalence Partitioning
into different classes where all members
of a class are related
partition where the program behaves in
an equivalent way for each class member
partition
Input test data
Output test results
anomalous
the presence of defects
• Input data and output results often fall
• Each of these classes is an equivalence
• Test cases should be chosen from each
11
Equivalence Partitioning
12
‘equivalence sets’
5-digit integer between 10,000 and 99,999 equivalence partitions are
sets
Equivalence Partitioning
• Partition system inputs and outputs into
• Choose test cases at the boundary of these
System
Outputs
Invalid inputsInvalid inputsInvalid inputs Valid inputsValid inputs
System
outputs
invalid inputs valid inputs
15
Testing Guidelines (Sequences)
have only a single value
different tests
and last elements of the sequence are
accessed
16
(T) ( ) ( ) 17 17 0 17 45 23 25
• Test software with sequences which
• Use sequences of different sizes in
• Derive tests so that the first, middle
• Test with sequences of zero length
Array Element Single value In sequence Single value Not in sequence More than 1 value First element in sequence More than 1 value Last element in sequence More than 1 value Middle element in sequence More than 1 value Not in sequence
Input sequence Key Key Output Found, L true, 1 17 false, ?? 17, 29, 21, 23 true, 1 41, 18, 9, 31, 30, 16, 45 true, 7 17, 18, 21, 23, 29, 41, 38 true, 4 21, 23, 29, 33, 38 false, ??
Search Routine - Input Partitions
17
program structure. Knowledge of the
program is used to identify additional test
cases
statements
White Box Testing
Component code outputs
18
White Box Testing
- independent paths within a module at least once
- logical decisions on their true and false sides
- loops at their boundaries and within their operational bounds
- structures to assure their validity
• Also called Structural testing
• Derivation of test cases according to
• Objective is to exercise all program
Test
Test data
Tests Derives
Exercise all
Exercise all
Exercise all
Exercise all internal data
22
Selective Testing
23
Basis Set
• of execution paths = set of paths
that will execute all statements and all
conditions in a program at least once
• defines the number
of independent paths in the basis set
• Goal : Define test cases for basis set
• Basis path testing
• Condition testing
• Loop testing
• Dataflow testing
loop < = 20x
Basis set
Cyclomatic complexity
• Basis set is not unique
24
Flow Graph Notation
25
Basis Path Testing
measure
+1 (uses flow-graph notation)
execution paths
tests that must be executed to guarantee coverage of all programs
Derive a logical complexity
Cyclomatic complexity CV(G)
- Number of simple decisions (compound decisions have to be split)
- Number of enclosed areas
In this case, CV(G) = 4 Use CV(G) to define a basis set of
CV(G) provides an lower bound of
1
2
6
3
7
4
8
5
11
9 10
6 4,
9
8
2,
1
7
10
11
Graph Cyclomatic Number V(G) = e - n + 1 Cyclomatic Complexity CV(G) = V(G) + 1
R 2 R 3 R 1
R 4
Ri
m Node Edge Region
28
Selective Testing
29
Condition Testing
program module
- Simple condition:
- Compound condition:
((a=b) and (c>d))
• Basis path testing
• Condition testing
• Loop testing
• Dataflow testing
• Exercises each logical condition in a
• Possible conditions:
- Boolean variable (T or F)
- Relational expression (a<b)
- Composed of several simple conditions
30
Condition Testing Methods
• Branch testing:
exercised at least once
• Domain testing:
a<b:
31
Selective Testing
- Each branch of each condition needs to be
- Relational expression
- Boolean expression with n variables
• Basis path testing
• Condition testing
• Loop testing
• Dataflow testing
34
n
n
Testing Simple Loops
loops
- skip the loop entirely through the loop
- through the loop
- m passes through the loop m < n
- (n-1) , n , and (n+1) passes through the loop
n = passes
35
Testing Nested Loops
loops to minimum values
range or excluded values
nested loops to typical values
Minimum conditions - simple
maximum number of allowable
• Just extending simple loop testing
- number of tests grows geometrically
• Reduce the number of tests:
- start at the innermost loop; set all other
- conduct simple loop test; add out-of-
- work outwards while keeping inner
- continue until all loops have been tested
36
Testing Concatenated Loops
other:
37
Bad Programming!
Testing Unstructured Loops
• Loops are independent of each
• Loops depend on each other: