You can monitor stubs execution to check against certain expectations, such as the number of calls to a given stub or stubs call the sequence of stub calls. Expectations should must be defined inside the a test cases and are verified just after the test case execution is finished. If the expectation is not met, then a suitable message is generated and output to the results. All expectations are removed at the end of test case execution after the outcome has been verified.
Stub expectations must precede all calls to the tested function to ensure that all stub calls are counted.
You can configure stub expectations for subs that are created with a test configuration where one of the following options is enabled:
See Dynamic Stubs Configuration 1 for additional information.