Top down Integration testing is a part of incremental approach, in which the testing is done by joining two or more modules that are logically related. This process is usually carried out by using dummy programs called, Stubs and drivers and is used in order to stimulate the behaviour of the lower level modules that are not yet integrated.
In Top-Down integration testing, the testing takes place from top to bottom, following the control flow or architectural structure. Here, only the top module is unit tested in isolation, after which, the lower modules are integrated one by one. This process is repeated until all the modules are integrated and tested. The main module is used as a test driver and stubs are substituted for all components directly subordinated to the main control. Moreover, stubs are replaced one at a time with actual components. These stubs are the modules that act as a temporary replacement for a called module and give the same output as that of actual product.
The representation of test cases in stubs can be difficult especially before the I/O functions are added and even then test conditions may prove to be impossible or extremely difficult to create, this in turn also makes observation of test output seemingly difficult.
Top down integration allows one to believe and assume that designing and testing can be overlapped which may not be the case and lastly it induces one to defer completion of the testing of certain modules. Considering it is always good to evolve the software and test software in pieces. Although it might be hard to imagine, if any of the pieces are left to be under developed and left incomplete.
There are four basic types of stubs for top-down testing. These are namely:
Stubs are said to be kept at a minimum level of complexity and this is mainly to avoid inducing errors when testing the unit in question even though they are viewed as throw away code but do not necessarily need to be thrown away as they can be filled in to form the actual method.
Stubs are mainly used because it's always a good idea to develop and further test software in pieces which is where stubs and drivers come in. Since software applications are made of units where ones output goes as an input into the other, for such reasons independent testing of a unit is not possible thus the use of a stub in order to test each unit in isolation making the software easier to use and also very effective for whatever purpose its being developed for which is the ultimate result for any software developed, with little or no errors.
Nowadays, software accuracy, quality, effectiveness, and outstanding functionality are constantly demanded by the Software Industry. Organisations around the world, are developing software and applications that majorly cater to these requirements. Moreover, developers and testers are working immensely hard and are validating through various testing techniques that the developed software or product is bug free and is developed as per the client’s requirements. Integration testing is one such type of testing technique, which tests the interfaces between the units or modules. Its four approaches– Big Bang, Top-Down, Bottom-Up and Sandwich/Hybrid –provides several advantages to the tester and ensures that the software’s performance is of superior quality. It is performed by a specific integration tester or test team, where the priority is given to the integrating links rather than the unit functions which are already tested. Furthermore, it focuses mainly on the interfaces and the flow of information between the modules. Hence, to ensure the quality and performance of the software, integration testing is the most sensible type of testing that should be implemented by testers all over the world.