You often reuse some of the same test steps in your test cases. For example, to open the application and logging into the application. Adding these separate steps each time you create a test case is time-consuming. Besides, if the password of the user changes you have to change the password in each test case that uses it. ATS has the functionality to create your own actions, this makes your test cases easier to maintain. You create your own actions from within a test case or by creating a new action from the repository. This how-to explains both ways of creating such actions.
This how-to will teach you how to do the following: * Extract actions * Create an extracted action from a test case * Create an extracted action by creating a new action
Before starting with this how-to, make sure you have completed the following prerequisites:
3 Extract actions
You can create an extracted action for all test steps that you use in more than one test case.
3.1 Create an extracted action from a test case
The following steps describe how to extract actions. In this example, we create an extracted action for the Open Mendix Application and Login actions:
- Create a test case and enter a name and a description.
- Add the Open Mendix Application and Login actions.
- Set the URL input parameter of the Open Mendix Application action to Environment URL.
- Enter the needed values in the Username and Password input parameters of the Login action.
- Select the checkboxes, which appear when hovering the steps, of both steps.
- Click Extract action.
Clicking extract action opens the Action - Set Details dialog box:
- Enter a name in the Name field. (For example, Open application and log in as employee). It is advised to give your test step a clear name, describing what it does.
- Enter a description in the Description field. (for example, This action opens the application, based on the environment URL, and logs into the application as employee). It is advised to give your test step a clear name, for example, describe what it does.
- Click Close.
You now created an extracted action. To view the test steps in the extracted action follow these steps:
- In your test case click the Drop-down menu of the extracted action.
- Click Open.
Clicking Open opens the Action Details page. On this page you see the test steps in the action. A test case only refers to an action, so if you change a value inside an action that change is noticed in all your test cases that use that action.
You can also open your extracted action from the repository, as this action is now added to the repository:
To use this custom action in other test cases follow these steps:
- Create a new test case and give it a name and description.
- Click Create step manually.
The folder with your application name contains all custom and extracted actions.
- Select the action you want to add as test step to your test case.
- Click Select
You have now added your extracted action to another test case. So, if the password changes you only have to change it within the action and not within each test case.
3.2 Create an extracted action by creating a new action
The following steps describe how to create an extracted action for deleting an expense in the company expenses app:
The actions needed to delete an expense are Click DataGrid row, Click Widget and Confirm Dialog.
The actions to delete an expense are always the same, but the value of the description can differ. The following steps describe how to create a reusable extracted action of deleting an expense.
- Open your project in ATS and click the Test cases menu item to open the Repository.
- Click the Actions drop-down.
- Click New Action.
Clicking New Action opens the Create new dialog box:
- Enter a name in the Name field. (for example, Find and delete an expense based on the description). Using a clear and concise naming structure is advised.
- Enter a description in the Description field (for example, *This action deletes an expense based on the description. The description can be entered in the input parameter Value.*). Giving each test case a description of what it does is advised.
- Click Create.
- Click create to open the Actions Details Page.
- Record the test steps needed to delete an expense, these are the Click DataGrid row, Click Widget and Confirm Dialog actions. You can also add the actions manually and enter the needed input parameters yourself.
- Click the Settings tab.
- Click New.
Clicking New opens the Edit Input Parameter dialog box:
- Enter Column Value in the Name field. When defining action parameter names, always use the ATS naming conventions.
- Enter a description in the Description field. (for example, Enter the value of the description of the expense to be deleted.). Giving each input parameter a description of what to enter in the input parameter is advised.
- Click Save.
Clicking Save adds the input parameter:
You now created a new input parameter. The next step is to link the input parameter to the correct test step.
- Click the Test steps tab.
- Open the Click DatGrid Row action.
- Change the input parameter to Column Value below Input values.
You now created an action which can delete a new expenses based on the description. To check whether the action deletes an expense based on the description, add the action to a test case. Enter the Column Value and run the test case:
Congratulations, you created a reusable extracted action to delete a new expense. Every time you want to delete an expense in your test cases you only have to add this actions and enter the input parameter.