This section provides details on using the stubs API for dynamic stubs configuration, which enables you to specify stub behavior for a specific test case. Stub behavior is defined inside the test case, which removes the need to modify the stub body to program test case-specific behavior.

This information is not required for typical test case management tasks using the Test Case Explorer and Test Case Editor (see Adding Test Suites and Test Cases with the Test Case Editor), but it may provide insights into accessing the Stubs API directly from the test case code or via the USE CUSTOM ACTION mode of the Stubs configuration step of the Test Case Editor.

Dynamic stubs configuration supersedes functionality described in Functions for Stubs Driven by Test Cases, which should only be used for legacy stubs and for cases where dynamic stubs configuration functionality is not sufficient. 

Configurable stubs provide an easy way of modifying function behavior without changing the original function definition. Behavior of the function can be defined and reconfigured dynamically. Typically, this configuration is a part of a test case and helps to achieve test case specific requirements for a particular function call. User-defined configuration of the function behavior is interpreted and executed by the stub function generated automatically by C++test.

  • No labels