The primary difference between the top-down and bottom-up integration testing is that the top-down integration testing utilizes the stubs for calling the submodules subordinated to the main function while in bottom-up integration testing the stubs are not needed instead drivers are used. The related redundancy is more in case of the top-down approach as compared to the bottom-up.
These two techniques are the part of the integration testing which provides an organised way to build the program structure simultaneously performing tests to detect errors associated with interfacing. Integration testing is mainly conducted to combine the unit tested components in order to construct the program according to the design specifications.
Content: Top-down Integration Testing Vs Bottom-up Integration Testing
|Basis for comparison||Top-down Integration Testing||Bottom-up Integration Testing|
|Basic||Uses stubs as the momentary replacements for the invoked modules and simulates the behaviour of the separated lower-level modules.||Use test drivers to initiate and pass the required data to the lower-level of modules.|
|Beneficial||If the significant defect occurs toward the top of the program.||If the crucial flaws encounters towards the bottom of the program.|
|Approach||Main function is written at first then the subroutines are called from it.||Modules are created first then are integrated with the main function.|
|Implemented on||Structure/procedure-oriented programming languages.||Object-oriented programming languages.|
|Risk analysation||Collaborating the impact of internal operational failures.||Models are used to analyze the individual process.|
|Complexity||Simple||Complex and highly data intensive.|
|Works on||Big to small components.||Small to big components.|
Definition of Top-down Integration Testing
The top-down integration testing is an incremental technique of building a program structure. It incorporates the modules while moving downward, beginning with the main control in the hierarchy. Sub-modules are then integrated to the main module using either a depth-first or breadth-first method. The main purpose of top-down integration is to verify the significant control and decision points earlier in the test process.
Integration process involves the following steps in the top-down approach:
- Starting with the major control module, stubs are then replaced for the components residing below the main modules.
- The replacement strategy of the subordinate stub relies on the type of integration approach followed (i.e., depth and breadth first), but only one stub is allowed to be replaced with actual components at a time.
- After the integration of the components, the tests are carried out.
- As a set of test is accomplished, the remaining stub is replaced with the actual component.
- In the end, the regression test is conducted to assure the absence of the new errors.
As the top-down testing uses stubs to replace the low-level data and it is not allowed to flow in the upward direction. There are three ways for doing so, firstly, till the replacement of stubs with actual functions is done the other functions are delayed. Secondly, the new stubs can be created which can perform restricted functions and imitate the actual stubs. In the last idea, the stubs can be integrated from bottom to up hierarchy. However, the last solution is termed as bottom-up integration, which is described in the next definition.
Definition of Bottom-up Integration Testing
The bottom-up integration testing starts with the construction of the fundamental modules (i.e., lowest level program elements). It integrates the components residing at the lowest level (i.e., lowest level) by providing a process and eliminates the need of the stubs. As the integration goes towards the upper direction, the requirement of the separate test drivers decreases. Hence, the amount of overhead is also reduced as compared to Top-bottom integration testing approach.
Bottom-up integration includes the following steps:
- It merges the low-level elements also known as builds into clusters which execute a certain software subfunction.
- The driver (Control program) is used in the bottom-up integration to arrange test case input and output.
- Then the cluster is tested.
- Clusters are incorporated while going upwardly in the program structure and drivers are eliminated.
Key Differences Between Top-down and bottom-up Integration Testing
- The top-down integration testing implements the stubs as a replacement for the low-level. As against, the bottom-up integration testing employs the drivers to pass the data to the lower level of modules.
- The main function is the most important part of the top-down integration testing through which other subroutines are called. On the contrary, the bottom-up approach emphasis on the lower-level modules and creates and integrates them at first.
- Structure/procedure-oriented programming languages implement top-down integration testing whereas bottom-up testing is implemented on the object-oriented languages.
- To examine the risk in top-down testing approach the effect of the internal operational defects are combined. In contrast, the bottom-up integration testing monitors the process separately with the help of the models.
- Top-down integration testing is simple relative the bottom-up testing.
- The top-down integration testing works through big to small components while the bottom-up approach is inverse of it.
In both of the approaches, top-down and bottom-up integration testing the top-down produces more redundant results and lead to additional efforts in the form of overheads. Conversely, the bottom-up approach is complex but more efficient than the former one.