Why do you use stubs and drivers in top down and bottom up approaches , how do they help

Questions by viiram845

Showing Answers 1 - 6 of 6 Answers

prabhakar

  • Oct 28th, 2007
 

Drivers are the readymade programs that instructs the hardware.

  Was this answer useful?  Yes

Stubs are replacements for called routines (object methods) that reproduce the behavior of the replaced routine to some level of fidelity.  A stub may return after doing nothing, or it may check the inputs and return a status or it may return predefined constant values in place of real values or it may return different values that depend on how many times it is called.  A stub may replace an entire subsystem.  There are a number of other terms used to describe stubs depending on their characteristics.  Not everyone agrees on these terms.

Drivers are programs that are designed to call routines or methods that cannot be compiled and linked on their own.  The purpose of drivers is to provide test data to the items being tested.  A single driver can incorporate many test cases and could be tied to a database that collects test results (test number, inputs outputs, expected outputs, returned status, execution time, pass/fail, test date, testers name, ......)

Top down and bottom up refer to integration strategies.  In the top down approach, the first real software item to be used is the main program.  All of its calls are replaced with stubs and it is tested.  Then one stub is replaced with a call to a real method.  That method will have stubbed out calls as well.  Only items that have passed the prescribed verification processes can be used in the integration.  This process proceeds until all of the stubs have been replaced with tested production software.

In the bottom up integration approach, a number of drivers are used to test the lowest level calls.  Then the lowest level methods are used instead of stubs to test the next level of methods.  First subsystems built and tested and then they are but together and tested.  This process is repeated until the entire system is integratted.  The last item to be intergrated is the main program.  The advantage of the bottom up process is that not as many stubs need to be produced and components do not have to be unit tested before integration.  The disadvantage is that a lot more drivers need to be produced.  If there are problems found post release, reintegration of the repairs can take more effort in the bottom up approach but the differences are not great.

Producing and saving stubs and drivers for unit testing and integration provides an invaluable tool for maintenance efforts. 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions