Using Custom Actions

Modified on Thu, 7 Aug at 3:12 PM

Custom Action Overview 

Custom action is needed when you want to extend the functionality of your automation framework beyond what default actions provided. Automation engineers and developers can write custom actions for incorporating any application specific requirements.


You can create custom actions in algoQA to simplify complex processes. For example, you can merge multiple steps into a single action, such as logging in with just one step instead of entering a username, password, and clicking the login button separately.

Custom actions provide flexibility to extend the functionality of algoQA. You can import your existing methods into algoQA and use them as custom actions to enhance your automation capabilities.


Note that the custom action name should not be exactly the same as the default action name, which means the custom action name must be unique. 


Creating  a Custom Action

Perform the following:

  1. After selecting a project navigate to Action List.
  2. Action List screen appears, click on Custom Action List and custom action Screen appears, click on Create Custom Action.In Action Details Form call the file name which is created, enter action name, method name, description and click on Save.


    As a best practice it is recommended to follow coding guidelines while creating custom actions for the chosen programming language.


  3. In a centralized project, multiple users collaborate on the same set of files simultaneously. To prevent conflicts, the platform offers a file locking feature. When a user begins working on a file, the platform identifies them as the active user for that file. As a result, when another user hovers over a file in the Utility folder, they will see a tool tip displaying the name of the active user who is currently working on the file. This is shown in the following screenshot. This helps prevent accidental edits.

  4. You can create a new custom action and if needed, refer to the Code Snippet pane from right side for assistance.  Click on copy icon  to copy the code and paste it into your required file.
    Following are the listed custom actions in the Code Snippet pane.
    • click 
    • enter text
    • verify displayed
    • verify unchecked
    • verify checked
    • click multiple times
    • double click
    • Drag And Drop
    • unchecked
    • checked
    • Clear and Enter Text
    • Right Click
  5. In the configuration step for a custom action, you can use the following basic structure for the chosen language, such as Java:
    Note: The language selected in script generation settings should be used for coding also.

    Java basic structure code snippet


Leveraging Custom Actions

Leveraging algoQA workflow you can add custom actions in Node Configuration, Recording scenario and Scenario editing features and functionalities.

Node Configuration


While configuring nodes, you can perform the following:

Updating Custom Action
While recording scenario, you can update the custom action.  click on more ( 3 dots ) icon besides the control, select default action and update with custom action by entering a custom action and clicking save
Configuring custom action
Perform the following: 

  1. Navigate to the Action List>>Custom Action List.
  2. Click on '+' icon to create a custom action.
  3. In the Custom action sheet:
    • Add the file name. 
    • Enter the Action name, Description and method name.
    • You can add the code for the custom action in code editor. 
      Following is an example of Java basic structure code used in configuring a custom action step:

      class CustomUtility {

      public void SimplifyWorkflow() {
      // Custom action code
      }


      }
      In this example,  <file name> is replaced with CustomUtility and <method name> with SimplifyWorkflow when creating a custom action.

       
      • Click Save. You can see the custom action in custom action list
      • In scenario steps list you click on edit icon to add custom action and click on save.
      • The Gwt step will reflect green indicating that the custom action is used here.
      • You can add custom actions using different methods. Following are the ways to add custom actions in .
        • You can reuse the custom actions for dynamic Xpaths.

          When configuring a custom utility method for dynamic XPaths, use the following configuration code:

          While creating method use this format in method name text field<method name>(XPath)

          In this code, XPath is the mandatory keyword . Ensure not to replace it.

        • If you wish to pass parameters to the same code, then use the following configuration code:
          While creating method use this format in method name text field <method name>(object, param)

          In this code, parameter can be an argument.

        • If you wish to pass without any parameter or dynamic XPaths, use the following configuration code.
          While creating method use this format in method name text field<method name>( )
        • If you wish to use an assertion, use the following configuration code:
          While creating method use this format in method name text field<method name> (assertion).
          In this code, custom action name must contain verify keyword.

        • If you wish to pass only parameters, use the following code:
          While creating method use this format in method name text field<method name>(param)



Importing custom actions

Navigate to the Utilities, click on more icon besides utility and select upload file.


Hiding a custom action

To hide a custom action:

Navigate to Settings>>Feature File Settings, select Hide Custom Action checkbox and click on update.




















Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article