What is Driver and stub in unit Testing?
Re: unit testing
I am fairly sure I have seen this question answered before, but havenít done a search.
Drivers and stubs, strictly, should not be used at all in unit testing, although very often are in order to make it easier to test. The term is more appropriate to integration testing. However, consider that you have a code module, lets call it module C that needs to be tested. Module C calls Module D and E, but Module D hasnít yet been written, so you write a stub called Module D which pretends to do what the real Module D will do when written. Module C is itself called by Module B, but Module B hasnít been written yet, so you write a driver which pretends to be do what Module B will do when written.
Module D (your stub) will be very simple and will simply return values that you set to enable you to test various outputs that your module C must deal with.
Module B (your driver) will be very simple and will simply call your Module C with values that you set to enable you to have various inputs to Module C.
Does that help?