ITPEC FE Subject A October 2024 Question 38

Which of the following is the appropriate explanation of a stub or a driver used in a test?

Explanation

A driver passes arguments and calls the module to be tested — a driver sits above the module under test, a stub sits below it.

A module often cannot be tested alone, so temporary modules stand in for its missing neighbours:

  • •Driver — a temporary calling module: it prepares test data, calls the module under test with arguments and receives its results; used in bottom-up testing, where the upper modules do not exist yet
  • •Stub — a temporary called module: it replaces a lower-level module that the module under test calls and returns fixed values; used in top-down testing

Answer (b)

Why not others:

  • •(a) — a module called from the module under test is a stub, not a driver
  • •(c) — the module used to call the module under test is a driver, not a stub
  • •(d) — receiving and checking the returned values is part of the driver's job; a stub is called by the module under test and only returns substitute values to it

Key rule: A driver calls the module under test (bottom-up testing); a stub is called by it (top-down testing).

System Development Technology · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.