Back to QMetry All Products Help Page
Shareable Test Cases
QAS provides Shareable Test Case feature that fulfills the purpose of test case reusability when a set of similar steps are used in multiple test cases . Users can create a sharable test case for common test steps. This test case is then shared and reused in more than one parent test cases. It saves testers' efforts and time that is consumed in adding repetitive steps into multiple test cases.
Â
Create a Shareable Test Case
Before creating a shareable test case, you need to move the test case locators to a .loc file for that - open the recorded test case, select the steps and click on the Repository button.
Steps:
1. Select consecutive steps from recorded test case and click on the Share button on the menu bar.
2. The Add New Test Case opens. Enter the test case name and click ADD.
A shareable test case is created which will be saved inside a shareable test suite folder. A shareable Test suite folder will be created if it doesn’t exist already.
The shareable test case will be created with default prefix 'Shrd' for the easy identification.
Note: Shareable test steps can be deleted but can not be renamed.
Update Shareable Test Case
Users can update steps in shareable test case and these changes will get reflected in all the test cases wherever that shareable test case is reused. To make any change in the existing shared test cases, it is recommended to perform Update rather than Add as updating a shared test case will also update all the test cases in which it is shared in.
Steps:
Record a test case with extra steps and move the test case locators to a .loc file as described under ‘Create a Shareable Test Case’.
Select the required test steps of the test case that you want to be appended to the shareable Test Case.
Select ‘+ Shareable Test Case' from the Test Case window toolbar and select Update. Refer screenshot below.
The Update Test Case pop-up opens.
4. Select the shared test case that is to be updated from the drop-down.
5. Click Update.
You can see the selected steps are appended to the existing shared test case.
View the details of Shared Steps
A quick-access button called ‘Step Details’ is available on the Test Case, clicking on this button users can view the shareable test case step details with its latest execution status in a new tab. This feature is only available for those shareable test cases in which Test Data is not attached.
Users can view the last execution detail of the shareable test case.
Use Shareable Test Cases
1. Create a test case and record its initial step.
2. To use a shareable test case, open the Command column drop-down of test step and select a shareable test case for that step.
Using Shareable Test Cases with Test Data
If the shared step is being used with test data in a test case, provide reference of the input variable. For example, there are two columns in the test data file: Username and Password.
In the shared step enter the placeholders -
For Username, replace the Input field values with ${Username} placeholderÂ
For Password, replace the Input field values with ${Password} placeholderÂ
Then use this shared test step in test cases.
Â
Execute shareable test cases by providing test data parameters directly at input level
Users can manage Test Data variables for shareable test cases at an individual test case level where the test case is reused. Irrespective of the original variables which are used in the shareable steps, users can use new test data variables in the reused shareable test case. The sequence of variables is considered while mapping the data.
For example,
A shareable test case ST1 is already in use in a test case which is using a Test Data TD1. Now the Test Data for the test case is changed to TD2 and so the corresponding variables for the test case are also changed.
In this scenario, users can still use the associated shareable test case ST1 by replacing the earlier variables with the different variables of the new test data TD2.
Note: Make sure the sequence of the variables is maintained to map them with the variables in the attached test data set.
The variables are mentioned within curly braces { }.
Syntax to mention the variables: ${variable1},${variable2}
Â
Export Shareable Test Cases
Shareable test cases can be exported as custom methods in source code. Users can obtain the reference of the shared Test Case in a .bdd feature file by exporting the code of a test case in which a shareable test case is used.
Steps
1. Click on the more menu for the test case and select Export.
The next screen shows the location where the code will be exported.
2. Click Export to proceed.
For better accessibility, users can directly go to the definition of a shareable test case from a .bdd file by right-clicking on the respective line and then selecting ‘Go to Definition’. It opens the code of shareable test case in a separate tab.
Shareable Test Case is mentioned as a custom method in the source code of shareable test case’s definition.
Â
Back to QMetry All Products Help Page