Creating Variables within Test Cases
Is there a way to create a variable within a testcase to determine the number of times that a particular stub was called?
Any variables added in this location will be displayed in the parameter tree and are also accessible within Configure Stubs User Code. Take a look at the following image for more details.
- These variables will only be displayed in the parameter tree after the environment has been rebuilt.
To count the number of times a stub has been called you can add the User Global, initialize it to zero in the parameter tree, then add Configure Stubs User Code to increment the variable (Environment | Configure Stubs | Edit).
- You will need to Save and Link after making modifications to Configure Stubs User Code.
- If you have set your unit under test as a Stub-By-Function (SBF) unit, you will get an error indicating that the variable is undeclared. To get around this error, you will need to declare the variable as an extern in Unit Prefix User Code (Environment | User Code | Edit).