Introduction to Callable Tests
It is possible to convert a Test Case into a Callable Test Case. This is recommended to encapsulate functionality and make it reusable across a number of Test Cases.
Callable Tests also reduce test maintenance, since they provide a centralized location for regularly used functionality. When changes occur to the functionality of the system under test, updates are required in fewer locations.
Refer to Test Case Design for more best practices around Callable Tests.
Create a Callable Test Case
Define the main Parameters and Settings in the Test Case. Then set ‘Callable’ on the Callable dropdown:
This will add a small red image against the Test Case in the Navigator to indicate that the Test Case is Callable.
You can now pass parameters into the Callable Test and also return output parameters. Refer to Configure Parameters for more information.
Then save the Test Case.
Invoke a Callable Test Case
To invoke a Callable Test Case, first open the Test Case which should call it. Then locate the Callable Test Case in the Navigator and click and drag it into the Calling test:
You will note that the Call is created as a new Test Step, containing Input and Output Parameters. These values can then be defined as required.
Callable Test Value Visibility
As your tests get more sophisticated, there is a danger that called Test Cases will start ‘stepping on each others toes’, with called Test Cases overwriting values on which other Test Cases depend.
Provar observes the following rules to mitigate these issues:
- Called Test Cases cannot ‘see’ their Caller’s values. These need to be passed as Input Parameters if required
- The Calling Test Case cannot see the Called Test Case’s values. These need to be returned as Output Parameters if required
- If a Called Test Case defines a value with the same name as the Calling Test Case, these values are kept separate from each other and the one will not overwrite the other
- Folder values and Global values are shared between Test Cases (refer to Result Scope for more information)