Stubs and drivers handle in integration testing being a top down integration testing and bottom up integration Testing.
While doing Integration, if we don’t hold all the modules get covered and urge to test a particular module which is covered then We Use Stubs and Drivers.
Stubs are dummy modules that are distinguish as "called programs", that is handle in integration testing (top down approach), it used when sub programs are under construction.
Stubs are the dummy modules that simulate the low level modules.
Drivers are also form of dummy modules which are distinguished as "calling programs”, that is handled in bottom up integration testing, it used when main programs are under construction.
Drivers are the dummy modules that simulate the high level modules.
Example of Stubs and Drivers is given below:-
Considering example if we have modules login, home, user. Login module is ready and urges to test it, but we call functions from home and user (which is not ready).
To test at a selective module we write a short dummy piece of a code which simulates home and user, which will return values for Login, this piece of dummy code is always called Stubs in a top down integration.
Resembling to the above example: If we have Home and User modules get ready and Login module is not ready, and we urge to test Home and User modules Which return values from Login module,
So to extract the values from Login module We write a Short Piece of Dummy code for login which returns value for home and user, So these pieces of code is always called Drivers in Bottom Up Integration.