Stubs and DrivesTesting program and function work as designedStubs* Pieces of programs, usually functions or procedures, that provide the correct interface but not the correct implementation of some other piece of program, typically a function or an abstract data structure.* A stub makes it possible to test certain aspects of a high-level function or abstract data type without having implemented all of the lower-level functions or abstract data types that it uses. Stubs are necessary when top-down programming is used Stubs* Stubs are program units that are stand-ins for the other (more complex) program units that are directly referenced by the unit being testedStubs characteristics * An interface that is identical to the interface that will be provided by the actual program unit * The minimum acceptable behavior expected of the actual program unit. (This can be as simple as a return statement.) Drives* Traditionally, a drivers is a piece of software that controls (drives) the unit being tested. Drivers are usually thought of as invoking, or at least containing, the unit being tested, i.e., units (being tested) are subordinate to their respective drivers.Drives* Drivers are programs or tools that allow a tester to exercise/examine in a controlling manner the unit of software being tested.Drives Characteristics* a means of defining, declaring, or otherwise creating, any variables, constants, or other items needed in the testing of the unit, and a means of monitoring the states of these items,* any input and output mechanisms needed in the testing of the unit, * a means of controlling the unit being tested, e.g., deciding when the unit will be invoked, and what information will be supplied upon invocation, * the generation and/or handling of any necessary interrupts, * the generation and/or handling of any necessary exceptions. Stubs and DriversUnits usually tested in standalone mode* Use drives for high-lever routines that call this unit * Use stubs for Lower-lever routines that are called this unit Stubs and Drivers |