Why We Use Stubs And Drivers?

Stubs are dummy modules that are always distinguish as "called programs", or you can say that is handle in integration testing (top down approach), it used when sub programs are under construction.

Stubs are considered as the dummy modules that always simulate the low level modules.

Drivers are also considered as the form of dummy modules which are always distinguished as "calling programs”, that is handled in bottom up integration testing, it is only used when main programs are under construction.

Drivers are considered as the dummy modules that always simulate the high level modules.

Example of Stubs and Drivers is given below:-

For Example we have 3 modules login, home, and user module. Login module is ready and need 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 and it is used in a top down integration.  

Considering the same Example above: If we have Home and User modules get ready and Login module is not ready, and we need 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 and it is used in Bottom Up Integration

So it is fine from the above example that Stubs act “called” functions in top down integration. Drivers are “calling” Functions in bottom up integration.


  1. thanks for clear idea

  2. Who will use this Stubs and Drivers?? Developers or White Box testers

    1. It means incremental testing or topdown or bottomup is done by developers?

    2. That's responsibility of white box testers.

    3. yes my que is also same integration testing is done by testers , i didnt write code for stubs and drivers ..so who will write code for stubs and drivers and who will perform integration testing .Plz reply.

  3. Who will write the code for dummy module(Stubs & Drivers)?

  4. I got an clear idea about stub and drivers

  5. Hi friends
    In this high & low level modmodules are written what are those can you explain me please. ....


Related Posts Plugin for WordPress, Blogger...