Create Custom Action Basics
Introduction
This how-to explains the basics of creating a custom action. You must complete this how-to before proceeding with How to Create Custom Actions.
This how-to teaches you how to do the following:
- Create a custom action
- Add parameters
- Connect parameters
Prerequisites
Before starting this how-to, make sure you have completed the following prerequisites:
- Have a general knowledge of ATS
- Complete How to Get Started
- Complete How to Create a Test Case
- Read Guidelines for Creating a Custom Action
Creating a Custom Action
The following sections describe how to create a custom action. There are two options for creating a custom action:
- Use the Add Item button in the Repository
- Use the Extract Action button
Option 1 – Using the Add Item Button in the Repository
-
Open your project in ATS and go to the Repository.
-
Click Add Item in the All Objects tab:
This opens the Create new dialog box:
-
Select Action in the drop-down menu.
-
Enter a name in the Name field (for example, Set Drop-Down). It is advisable to use a name that describes what the action does.
-
Enter a description in the Description field (for example, This action sets the drop-down menu to a specific value). It is advisable to give each action a detailed description of what it does.
-
Click Create:
You have now created a custom action from the repository.
Option 2 – Using the Extract Action Button
To use the Extract Action button, follow these steps:
-
Open your project in ATS and go to the Repository.
-
Select a test case or action and open it.
-
Select the test steps you want to combine in a custom action by holding Ctrl while clicking the test steps.
-
Click Extract Action:
This will open the Action - Set Details open.
-
Enter a name in the Name field (for example, Set Drop-Down).
-
Enter a description in the Description field (for example, This action sets the drop-down menu to a specific value).
-
Click Close:
-
Select the newly created action and click Open:
Both ways open the Edit Action page. The page works the same as the Test Case page. You can add test steps by clicking Add or Record.
You now know how to create a custom action.
Adding Parameters
To add parameters to your custom action, follow these steps:
-
Go to the Edit Action page of your action.
-
Click the Settings tab:
-
Follow the steps in the sections below for adding input and output parameters.
Adding Input Parameters
To add input parameters, follow these steps:
-
Click New:
This will open the Edit Input Parameter dialog box.
-
Enter a name in the Name field (for example, Widget Name).
Use the ATS naming convention -
Enter a description in the Description field (for example, Enter the name of the widget).
You must make sure everybody understands what information they must enter. -
Select a data type from the Datatype drop-down menu (for example, String).
-
Select a Show as Password option. This makes the parameter field unreadable. The default setting is No.
-
Select a Required/Optional option. For example, the Widget Name parameter is always required, otherwise the action does not work.
-
Leave the Type field set to Default.
-
Click Save:
You have now created an input parameter. You can add as many input parameters as you need, but remember to keep the action simple.
Adding an Output Parameter
-
Click Set:
This opens the different Output Parameter fields.
-
Enter a name in the Name field (for example, Element).
The user must know what the action returns, so be clear in the name that you enter. -
Enter a description in the Description field. Use this field to give a more detailed description of what is returned.
-
Select a data type from the Datatype drop-down menu (for example, Web Element).
-
Select a Required/Optional option. Only use Optional if the action still works when nothing is returned.
-
The Output Parameter requires additional steps. Go to the Test Steps tab and click Add.
-
Add the Find/Assert Widget action and the Set Return Value action.
-
For ATS to return the outcome of a test step as an Output Parameter, it needs to know what it must return. ATS returns the Value connected to the Set Return Value action. Now connect the outcome of test step 1 to the Set Return Value action.
ATS now returns the outcome of test step 1.
Make sure the datatype of the Output Parameter corresponds with datatype of the connected outcome.
You now know how to add parameters to your custom action.
Connecting the Input Parameters
To connect the input parameter, follow these steps:
-
Select the test step to which you want to connect an input parameter.
-
Open the Edit Input Value dialog box:
-
Click Action Input Parameter and select the input parameter you want to connect.
-
Click Save
You have now connected your input parameter.