Loading

What is meant by Stubs and Drivers?


Stubs and Drivers

What is meant by Stubs and Drivers?

In the field of software testing, the term stubs and drivers refers to the replica of the modules, which acts as a substitute, to the under developed or missing module.

The stubs and drives are specifically developed, to meet the necessary requirements of the unavailable modules.

What's their need?

Consider an example of a web application, which consists of 4 modules i.e., Module-A, Module-B, Module-C and Module-D. Each of the following modules is responsible for some specific activity or functionality, as under

Module-A ? Login page of the web application

Module-B → Home page of the web application

Module-C → Print Setup

Module-D → Log out page

The modules A, B, C & D involves the interdependencies of each module over other.

It is always preferable, to perform testing, in parallel, to the development process. Thus, it implies that subsequent testing must be carried out, immediately after the development of the each module.

Module-A, will be tested, as soon as, it develops. However, to carry out and validate the testing procedures in respect of module-A, there urges the need of module-B, which is not yet developed. The expected functionality of the login page (module-A) could be validated, only if it is directed to the home page (module-B), based on the valid and correct inputs.

But, on the non-availability of the module-B, it will not be possible to test module-A. These types of circumstances, introduces the stubs & drivers in the process of software testing. A dummy module, representing the basic functionality or feature of the module-B, is being developed, and thereafter, it is being integrated with the module-A, to perform testing, efficiently.

Similarly, stubs and drivers, are used to fulfil the requirements of other modules, such as

Log out page (Module-D), needs to be directed to the login page (Module-A), after successfully logging out from the application. In the event of unavailability of Module-A, stubs and drivers will work as a substitute for it, in order to carry out the testing of module-D.

Are Stubs and Drivers, same?

Yes, basically the features and purpose of stubs and drivers are same. Both of them work as a substitute for the missing or unavailable module. However, the difference between them can be visualized during the integration testing.

Stubs are commonly referred to as "called programs" and are being used in top bottom approach of the integration testing, whereas drivers are "calling program" and they are used in bottom-up integration testing.

Stubs are similar to the components, which are under test, in a very simple and basic form, whereas driver is used to invoke the component that needs to be tested.

Stubs, are usually, considered for low level modules, whereas drivers represents the high level modules.

Key Points

  • Stubs and Drivers works as a substitute for the missing or unavailable module.
  • They are specifically developed, for each module, having different functionalities.
  • Generally, developers and unit testers are involved in the development of stubs and drivers.
  • Although, it provides ease to carry out testing of individual components, without concerning the availability of other modules, but it is a time-consuming process, as it requires to develop dummy for each missing module.
  • Their most common use may be seen in the integration incremental testing, where stubs are used in top bottom approach and drivers in a bottom up approach.