Friday, November 15, 2024
Google search engine
HomeGuest BlogsDifference between Stubs and Drivers

Difference between Stubs and Drivers

Prerequisite : Software Engineering | Integration TestingĀ 

There are many primary elements that are required to make the product testing lucid hassle-free. Every element has its own specific utility that helps a lot while software testing and delivering the expected functionality as per the SRS document as much as possible. Stubs and Drivers are two such elements that play a very crucial role while testing; they replace the modules that havenā€™t been developed yet but are still needed in the testing of other modules against expected functionality and features.Ā 

Stubs and Drivers :Ā 
The Stubs and Drivers are considered as elements which are equivalent to to-do modules that could be replaced if modules are in their developing stage, missing or not developed yet, so that necessity of such modules could be met. Drivers and stubs simulate features and functionalities, and have ability to serve features that a module can provide. This reduces useless delay in testing and makes the testing process faster.Ā 

Stubs are mainly used in Top-Down integration testing while the Drivers are used in Bottom-up integration testing, thus increasing the efficiency of testing process.Ā 

1. Stubs :Ā 
Stubs are developed by software developers to use them in place of modules, if the respective modules arenā€™t developed, missing in developing stage, or are unavailable currently while Top-down testing of modules. A Stub simulates module which has all the capabilities of the unavailable module. Stubs are used when the lower-level modules are needed but are unavailable currently.Ā 

Stubs are divided into four basic categories based on what they do :Ā 

  • Shows the traced messages,
  • Shows the displayed message if any,
  • Returns the corresponding values that are utilized by modules,
  • Returns the value of the chosen parameters(arguments) that were used by the testing modules.

2. Drivers :Ā 
Drivers serve the same purpose as stubs, but drivers are used in Bottom-up integration testing and are also more complex than stubs. Drivers are also used when some modules are missing and unavailable at time of testing of a specific module because of some unavoidable reasons, to act in absence of required module. Drivers are used when high-level modules are missing and can also be used when lower-level modules are missing.Ā 

Ex : Suppose, you are told to test a website whose corresponding primary modules are, where each of them is interdependent on each other, as follows:Ā 

  • Module-A : Login page website,Ā 
  • Module-B : Home page of the websiteĀ 
  • Module-C : Profile settingĀ 
  • Module-D : Sign-out page

Itā€™s always considered good practice to begin development of all modules parallelly because as soon as each gets developed they can be integrated and could be tested further as per their corresponding interdependencies order with a module. But in some cases, if any one of them is in developing stage or not available in the testing process of a specific module, stubs or drivers could be used instead.Ā 

Assume Module-A is developed. As soon as itā€™s developed, it undergoes testing, but it requires Module-B, which isnā€™t developed yet. So in this case, we can use the Stubs or Drivers that simulate all features and functionality that might be shown by actual Module-B. So, we can conclude that Stubs and drivers are used to fulfill the necessity of unavailable modules. Similarly, we may also use Stubs or Drivers in place of Module-C and Module-D if they are too not available.Ā 

Do both drivers and Stubs serve the same functionality?Ā 
Yes, we can say both serve the same feature and are used in the absence of a module(M1) that has interdependencies with an other module(M2) that is need to be test, so we use drivers or stubs in order to fulfill module(M1)ā€™s unavailabilityā€™s and to serve its functionality.Ā 

Difference between Stubs and Drivers :Ā 

S.No. Stubs Drivers
1. Stubs are used in Top-Down Integration Testing. Drivers are used in Bottom-Up Integration Testing.
2. Stubs are basically known as a ā€œcalled programsā€ and are used in the Top-down integration testing. While, drivers are the ā€œcalling programā€ and are used in bottom-up integration testing.
3. Stubs are similar to the modules of the software, that are under development process. While drivers are used to invoking the component that needs to be tested.
4. Stubs are basically used in the unavailability of low-level modules. While drivers are mainly used in place of high-level modules and in some situation as well as for low-level modules.
5. Stubs are taken into use to test the feature and functionality of the modules. Whereas the drivers are used if the main module of the software isnā€™t developed for testing.
6. The stubs are taken into concern if testing of upper-levels of the modules are done and the lower-levels of the modules are under developing process. The drivers are taken into concern if testing of lower-levels of the modules are done and the upper-levels of the modules are under developing process.
7. Stubs are used when lower-level of modules are missing or in a partially developed phase, and we want to test the main module. Drivers are used when higher-level of modules are missing or in a partially developed phase, and we want to test the lower(sub)- module.
RELATED ARTICLES

Most Popular

Recent Comments

ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
źøˆģ²œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
źµ¬ģ›”ė™ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ˜¤ģ‚°ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ•ˆģ–‘ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė™ķƒ„ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ„œģšøģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶„ė‹¹ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ź³”ė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź³ ģ–‘ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ģ„±ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ²œķ˜øė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?