Difference in Drivers and Stubs | Software Testing

In the earlier article we saw what role test drivers and test stubs play in software testing especially in unit testing of modules. These programs are used extensively by developers to unit test the modules when the related modules have not been developed fully.

What is the difference between stubs and drivers in software testing?


Stub
  1. Stubs are created in the integration testing that is following Top-down approach.
  2. Stub is a piece of code emulating a called function. Stub is created by the tester when high level modules are being tested and the other modules are not yet created. Overall testing is only possible when all the modules are present and dummy modules have to be created to replicate basic functionality of modules under construction.
  3. A stub is basically a piece of code that simulates the activity of missing modules. I just accepts the value from calling module and returns null value.

Driver programs, Stub programs, software testing, what are drivers and stubs
Test Stubs and Test Drivers

Driver
  1. A driver is a piece of code which is emulating a calling function. Basically we call the driver as main function which calls other modules to form complete applications.
  2. Drivers are created in integration testing following bottom-up approach. Dummy main function has been created which will call other sub modules.
  3. A piece of code that passes test cases to another piece of code. Drivers invoke modules under testing.
One simple way to remember the difference in stubs and drivers is to remember drivers are ”calling” function while stubs are ”called” functions.

Read More:
Pros and Cons of White Box testing
Benefits and Drawbacks of Black Box testing

Copyright © ianswer4u.com

0 Reactions:

Post a Comment