Parameterize and Modularize a Classic Test Case
The parameterization and modularization of classic test cases have similar objectives: - Reduce the cost of test case creation and maintenance; - Improve the readability of the test repository by reducing the repetitions and number of test cases.
Parameterize a Classic Test Case
Squash TM enables you to parameterize the prerequisites and test steps of a classic test case with parameters and datasets.
This feature is particularly useful when you want to test different value combinations for one single scenario. Instead of duplicating the test case, just write it once, then parameterize it.
Parameters
To write a parameter, enter it as such: ${‘Parameter_name’} in a test case's prerequisites or test steps.
Focus
The name of the parameter must only contain the following characters: [0-9], [a-z], [A-Z] and [-,_] and must not contain any space, special character or accent.
The created parameters are automatically indexed in the table of the Parameters and datasets anchor , and the name of each parameter is entered in the heading of each column.
You can add new parameters directly from this table via the button [+] but they will not be used if they are not in the test case's prerequisites or test steps. Therefore, we recommend that you enter the parameters directly in the prerequisites or test steps so that they are automatically retrieved in the "Parameters and datasets" block.
Datasets
Datasets represent sets of values that will replace the parameters during test executions.
You can add datasets from the Parameters and datasets table by clicking on the button [Add dataset] and entering the value of each parameter.
Each row of the Parameters and datasets table represents a dataset.
During the execution of the test case, the parameters are replaced by values defined in datasets.
Info
When you integrate a test case with multiple datasets to an Execution plan (Campaigns workspace), it will be added as many times as there are datasets.
Modularize Tests with Test Calls
A test case call enables you to pool recurring test steps within one test case to integrate it and re-use it in other test cases.
For example, instead of repeating the login steps in every test, one test containing these steps is written only once and it will be called by every test case that needs a login step.
This feature also enables you to build a test case based on other test cases to get end-to-end tests.
Call a Test Case
You can call a test case from the Prerequisites and Test steps in two different ways:
- From the test case library, drag and drop your test case before or after any test step;
- Click on the button […] on the top right of the test step, then on the option "Call a test case". Drag and drop your test case from the test case repository part to your chosen location.
A called test case is seen as a test step of the calling test case.
You can view the steps of the called test case by clicking on
Focus
You can't call a Gherkin or BDD test case.
The "Test case called by" block of the called test case contains the list of the calling test cases. This enables you to identify the test cases affected by an update of the called test case.
Focus
To delete a called test case, you must first delete the corresponding test steps in the calling test cases. This block enables you to find them easily.
During the execution, the test steps of the called test case are seen as test steps of the calling test case.
Exemple: The test case "Access application" hereunder is calling the test case "Log onto the app". During the execution, the test steps of the called test case are seen as the test steps of the calling test case.
Choose a dataset
During the call of a test case containing datasets, Squash TM enables you:
-
To re-use one of the datasets of the called test case (option "Choose a dataset among those of the called test case"). During the execution, the parameter is automatically replaced by the value of the chosen dataset.
-
Define a new dataset in the calling test case (option "Do not choose a dataset among those of the called test case (delegated parameter)"). The parameters from the called test case appear as the parameters of the calling test case. Thus, they can have new datasets as values.