Using parameters and adopting a modular approach to test case design is an effective way to boost reusability for large test-case libraries.
The most valuable test cases are broadly applicable and reusable across different cycles and releases. To effectively reuse test cases, test engineers must design them to be only as specific as required and generic enough to be reused in different situations with different data inputs. Instead of duplicating or copy/pasting test cases or steps, break them down into small, reusable pieces to give yourself the ability to assemble them into larger end-to-end testing scenarios.
Testers can break down test cases into logical, manageable functions or modules. These isolated modules can be used to create independent tests, and they can be reassembled to create larger end-to-end test cases.
Parameters provide additional flexibility to make your modules even more generic and reusable. They can contain editable default values that allow testers to meet the needs of various testing situations. When invoking a reusable module that contains parameters, the main test case passes the parameters, which can affect how input or output data are displayed or processed during test execution.
You can nest as many child modules called under any main test case as desired and with multiple levels. Each set of steps unfolds during the test execution (with the parameter replaced) as displayed in the following diagram:
Creating Test Case Parameters
- Click the Test Script tab.
- Ensure the Type is Step-by-Step.
- Click the dropdown, then click Parameters.
- Click Add Parameter and type the parameter’s name. The Default Value field is optional.
- You can drag and drop parameters in the Parameters section (on the Test Script tab) to adjust the order in which they appear.
In the Steps section, type a brace, sometimes called a curly bracket, to display the list of parameters you’ve created.
- Reference the desired parameter for the step by selecting it from the dropdown list.
- Each step unfolds during the test execution, and the parameters are replaced with the values from the main test case.
Calling a Test Case with Parameters
- Click the Test Script tab.
- Click Call to Test to reuse the steps of the desired test case below the current step.
- Select one or more test cases to reuse the steps. Note that you can select test cases from any Jira project.
- Click Add. The called test case is added below the step from which it was called.
- You can add manual inputs for parameters on the called test case or use the default values.
- The steps unfold in the Test Player during test execution, and the parameters are replaced with the values from the main test case.
Calls to test are links to the source test-case steps. If you make changes to the source steps, those changes will replicate automatically.