23-Validation Activities - Unit, Integration Testing-07-03-2024
23-Validation Activities - Unit, Integration Testing-07-03-2024
Validation
Validation
• It
is a set of activities that ensures the software under consideration has
been built right and is traceable to customer to customer requirements.
• Validation is performed after the coding is over
• Last chance to discover bugs
• It enhances the quality of software
2
Validation Activities
1. Validation Test plan
2. Validation Test Execution
3
Validation Activities
Validation Test plan’s during the SDLC phase:
1. Acceptance test plan
2. System test plan
3. Function test plan
4. Integration test plan
5. Unit test plan
4
Validation Activities
Validation Test Execution
1. Unit validation testing
2. Integration testing
3. Function testing
4. System testing
5. Acceptance testing
6. Installation testing
5
1. Unit validation testing
It ensures whether the software meets atleast a baseline level of functionality prior
to integration and system testing
Software is divided into modules and each module is not an isolated entity
6
1. Unit Testing
7
Stubs and Drivers
8
Drivers
• The Stubs and Drivers are those components that are used as a short-term alternative
for a module.
• Stubs and drivers both are dummy modules and are only created for test purposes.
• Driver module is a simulated module which provides the required input to the
testing module
• The Drivers establish the test environments and takes care of the communication,
estimates results, and also sends the reports.
It is a dummy module and works as a stand-in for the subordinate unit and provides
minimum required behavior for that unit
main ()
{
int a, b, sum;
scanf(“%d”, &a, &b);
c = sum(a,b);
printf(“%d”,c);
}
11
2. Integration Testing
• It exposes inconsistencies between the modules
• Data can be lost across the interfaces
• One module combined with other will not give a desired result
• Datatypes and valid ranges may mismatch
Three approaches
1. Decomposition based integration
2. Call graph-based integration
3. Path-based integration
Fig. Decomposition Tree
12
Decomposition based integration
Two approaches
1. Non-incremental Integration testing
2. Incremental Integration testing
13
Decomposition based integration
Non-incremental Integration testing
14
Decomposition based integration
Incremental Integration testing
• It
tests one module at a time and integrate another one module, test it and
the process continues until all the modules are integrated and tested.
• Incremental testing uses several stubs and drivers to test the modules one
by one.
• This helps us discover many errors and defects in the modules.
15
Decomposition based integration
Types of Incremental Integration testing
1.Top-down Incremental testing
Depth-first integration
Breadth-first integration
Here, the higher level modules are tested first then the lower level modules are tested.
This approach uses Stubs which are mainly used to simulate the submodule, if the
invoked submodule is not developed this Stub works as a momentary replacement.
16
Decomposition based integration
Breadth-first integration
17
Decomposition based integration
Breadth-first integration
18
Decomposition based integration
Breadth-first integration
19
Decomposition based integration
Drawbacks of Top-down Integration Procedure
• Stubs and drivers must be prepared for testing one module
• Stubs are more complicated than they first appear
• Representations of test cases in stubs can be difficult
20
Decomposition based integration
2. Bottom-up Integration Procedure
In Bottom Up Integration Testing, testing takes place from bottom to up.
Lowest level modules are tested first and then high-level modules and finally
integrating the high-level modules to a low level to ensure the system is working as
intended.
Drivers are used as a temporary module for integration testing.
It is useful for integrating OO systems, real-time systems and systems with strict
performance requirements.
21
Decomposition based integration
2. Bottom-up Integration Procedure
22
Decomposition based integration
2. Bottom-up Integration Procedure
23
Decomposition based integration
It is better suited for monitoring the progress of integration testing along the
decomposition tree
• Failures can be easily tracked
• It requires more effort in the form of stub and drivers
The integration testing effort is computed as the number of test sessions. A test
session is one set of test-cases for a specific configuration.
24
Call Graph-Based integration
It is used to detect some behavioural bugs/defects.
Refine the functional decomposition tree into module call graph
A call graph is a directed graph, wherein the nodes are either modules or units, and a
directed edge from one node to another means, one module has called another
module.
A call graph can be captured in a matrix form called Adjacency Matrix
This avoids the use of stubs and drivers.
25
Call Graph-Based integration: Example
26
Call Graph-Based integration
27
Call Graph-Based integration
30
1. Pair-wise integration testing
Answer
Step #1: Let’s list down the variables involved. 5) Order type
• 1) Order category a. E-Booking
a. Buy b. In-store
b. Sell
• 2) Location 6) Order time
a. Delhi a. Working hours
b. Mumbai b. Non-working hours
• 3) Car brand
a. BMW If we want to test all possible valid
b. Audi combinations:
c. Mercedes = 2 X 2 X 3 X 5000 X 2 X 2
• 4) Registration numbers = 240000 Valid test cases combinations
a. Valid (5000)
b. Invalid Invalid combinations will be infinite
31
1. Pair-wise integration testing
Answer
Step #2: Let’s simplify
– Use a smart representative sample.
– Use groups and boundaries, even when data is non-discrete.
– Reduce Registration Number to Two
• Valid registration number
• Invalid registration number
32
1. Pair-wise integration testing
Answer
Step #3: Arranging variables and values involved.
• When we arrange variables and values involved, it looks something like this.
Now order the variables so that the one with the most number of values is first and the least is last.
33
1. Pair-wise integration testing
Answer
Step #4: Arrange variables to create a test suite
• Let’s start filling in the table column by column. Initially, the table should look something
like this. The three values of Product (variable having the highest number of values)
should be written two times each (two is the number of values of next highest variable
i.e. Order category).
34
1. Pair-wise integration testing
Answer
Step #4: Arrange variables to create a test suite
• The Order Category column has two values. That’s how many times we need to insert the
values of the first column, Product.
35
1. Pair-wise integration testing
Answer
Step #4: Arrange variables to create a test suite
• For each set of values in column 1, we put both values of column 2. Repeat the same for
column 3.
36
1. Pair-wise integration testing
Answer
Step #4: Arrange variables to create a test suite
• We have a Buy and Delhi, but wait – there’s no Buy and Mumbai. We have a Sell and
Mumbai, but there’s no Sell and Delhi. Let’s swap around the values in the second set in the
third column.
37
1. Pair-wise integration testing
Answer
Step #4: Repeat the same steps for column 3 and 4.
When columns 3 and 4 are compared, each value in column 3 has both the values of column 4.
But when you compare the 2nd and 4th column, we have Buy and Valid & Sell and Invalid .i.e. Buy
does not have ‘Invalid’ and Sell does not have ‘Valid’.
Hence we need to interchange the last set of values in the 4th column.
38
1. Pair-wise integration testing
Answer
Step #4: Adding column 5 and 6.
39
1. Pair-wise integration testing
Answer
Step #4:
Column 6 (Order time) is problematic. We are missing Buy/Non-working hours and
Sell/Working hours. We can’t fit our missing pairs by swapping around values as we already
swapped all the rows if we swap now we may miss other possible pairs which are already
sorted. So, we add two more test cases that contain these pairs. Hence, the blank rows!
40
1. Pair-wise integration testing
Answer
Step #4:
Now we will fill in the empty cells as we desire because the other variable values are purely
arbitrary (or Don’t Cares ~).
41
1. Pair-wise integration testing
Another Example
42
1. Pair-wise integration testing
Limitations
• It fails when the values selected for testing are incorrect.
• It fails when highly probable combinations get too little attention.
• It fails when interactions between the variables are not understood well.
43
2. Neighbourhood integration testing
A form of integration testing where all of the nodes that connect to a given node are the
basis for the integration testing.
The neighborhood for a node is the immediate predecessor as well as the immediate
successor nodes.
They can be defined as the set of nodes that are one edge away from the given node.
44
2. Neighbourhood integration testing
The neighborhood of each node in the call graph is shown in the figure:
45
2. Neighbourhood integration testing
Another Example:
46
2. Neighbourhood integration testing – Pros and
Cons
47
3. Path Based Integration
Message:
• A programming language mechanism by which one unit transfers control to another
unit
• Usually interpreted as subroutine / function invocations
• The unit which receives the message always returns control to the message source
3. Path Based Integration
Module Execution Path
3. Path Based Integration
Some of the definitions are:
MM-Path:
A module to module path is an interleaved sequence of module execution paths and
messages
Used to describes sequences of module execution paths that include transfers of control
among separate units
MM-paths always represent feasible execution paths, and these paths cross unit
boundaries
3. Path Based Integration
MM-Path Examples:
3. Path Based Integration
Some of the definitions are:
MM-Path Graph:
Given a set of units their MM-path graph is the directed graph in which
• Nodes are module execution paths
• Edges correspond to messages and returns from one unit to another
Cons:
There is a significant effort involved in identifying MMpaths
Comparison of Integration-based Testing Techniques
Function Testing
It is the process of attempting to detect discrepancies between the functional specification
of a software and its actual behavior.
Its objective is to measure the quality of the functional components of the system.
1. Test Planning
2. Functional decomposition
3. Requirement definition Functions/Features Priority Test Cases
4. Test case design
F1 3 T2, T4, T6
5. Traceability matrix formation
6. Test case execution F2 1 T1, T3, T5
System Testing
It is the process of attempting to demonstrate that a program or system does
not meet its original requirements and objectives as stated, in the requirement
specification.
2. Beta Testing
Tests are conducted at the customer site by the end-users.
Development team does not have any control over the test environment.
References
1. Ian Sommerville, Software Engineering, 9th Edition, Addision-Wesley, 2016
2. Naresh Chauhan, Software Testing Principles and Practices, OXFORD University
Press, 2013.