Top down integration testing is a technique where the behaviour of the lower-level modules is yet to be integrated and simulated. In this type of test, the highest-level logic and flowing of data is tested early in this process.
While stubs are modules that act temporarily as replacement for a module called and give the exact output as would with the actual product, it's therefore used to simulate the sub modules, these are also used when the software has to interact with an external system.
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.