Professional Documents
Culture Documents
4.1 Software Testing
4.1 Software Testing
Verification Validation
Integration testing
testing parts of the system by combining the modules
To find the interface errors
System testing
testing of the system as a whole after the integration phase
Acceptance testing
testing the system as a whole to find out if it satisfies the requirements specifications
return 0;
}
A driver simulates a module that calls the module currently being tested
Mock objects: Create an object that mimics only the behavior needed
for testing
CA3401 Software Engineering Dr. Ashish Kumar Sahu 18
Integration Testing
Integration testing: Integrated collection of modules tested as a group or partial
system
Integration plan specifies the order in which to combine modules into partial
systems
float ACIRCLE()
{
float R;
R=Get_Radius(R);
A=R*R*3.14;
return A;
}
int main(){
int R,L;
float Area;
Area=ACIRCLE(R );
printf(“%d”, Area);
return 0;
}
CA3401 Software Engineering Dr. Ashish Kumar Sahu 20
Module Structure
level 3 A B
• We assume that
the uses hierarchy is
a directed acyclic graph.
level 2 • If there are cycles merge
D them to a single module
C H
level 1
level 0 E F G I
Modules at lower levels are tested using the previously tested higher level
modules
Requires a module driver for each module to feed the test case input to the
interface of the module being tested
However, stubs are not needed since we are starting with the terminal modules and
use already tested modules when testing modules in the lower levels
C H
E F G I
After a module is tested, the modules directly called by that module are
merged with the already tested module and the combination is tested
Requires stub modules to simulate the functions of the missing modules that
may be called
However, drivers are not needed since we are starting with the modules which is not
used by any other module and use already tested modules when testing modules in the
higher levels
C
H
E F G I
During the maintenance phase, when a change is made to the program, the test
cases that have been saved are used to do regression testing
figuring out if a change made to the program introduced any faults
When you find a bug in your program you should write a test case that exhibits the
bug
Then using regression testing you can make sure that the old bugs do not reappear
O1= Not a triangle, when any of the sides is greater than the sum of
the other
O2 = Equilateral Triangle
O 3= Isosceles Triangle
O 4= Scalene Triangle
CA3401 Software Engineering -1, 0 , 1, mid, max-1, max, max+1 Dr. Ashish Kumar Sahu 50
Worst BVA: 5n test cases
The starting point for path testing is a program flow graph that shows
nodes representing program decisions and arcs representing the flow
of control.
1
1, 2, 5, 6
2 1, 2, 3, 4, 2, 6
1, 2, 3, 4, 2, 3, 4, 2, 5, 6
3
…
Prepare test cases that will force the execution of each path in the basis set.
1. V(G) = e – n + 2P
= 13 – 10 + 2 = 5
2. V(G) = + 1
= 4 + 1 = 5
3. V(G) = number of regions
= 5
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 outer
loops at their minimum iteration parameter (e.g., loop counter) values. Add
other tests for out-of-range or excluded values.
3. Work outward, conducting tests for the next loop, but keeping all other
outer loops at minimum values and other nested loops to “typical” values.
4. Continue until all loops have been tested.
CA3401 Software Engineering Dr. Ashish Kumar Sahu 83
Loop Testing
Concatenated loops. Concatenated loops can be tested using the
approach defined for simple loops, if each of the loops is independent
of the other.
Data flow testing is used to analyze the flow of data in the program.
During the maintenance phase, when a change is made to the program, the test
cases that have been saved are used to do regression testing
figuring out if a change made to the program introduced any faults
When you find a bug in your program you should write a test case that exhibits the
bug
Then using regression testing you can make sure that the old bugs do not reappear
Involves the use of memory dumps, run-time traces, and output statements
Leads many times to wasted effort and time
1. int i;
1. int i; 2. int sum = 0;
2. int sum = 0; 3. int product = 1;
3. int product = 1; 4. int w = 7;
4. int w = 7; 5. for(i = 1; i < N; ++i) {
5. for(i = 1; i < N; ++i) { 6. sum = sum + i + w;
6. sum = sum + i + w; 7. Printf(“%d”, sum);
7. product = product * i; 8. product = product * i;
8. } 9. Printf(“%d”, product);
9. Printf(“%d”, sum); 10. }
CA3401 Software10.Printf(“%d”,
Engineering product); 11.Printf(“%d”, sum);
Dr. Ashish Kumar Sahu 109
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
// good
$my_email
->set_from('test@email.com')
->add_to('programming@gmail.com')
->set_subject('Methods Chained')
->set_body('Some long message')
->send();