How can I click a UI Action/Button in ATF?

Mmodi
Tera Contributor

Hi everyone,

 

I'm trying to automate a test in ServiceNow ATF and need to click a button (UI Action) on a form as part of the test.

I can open the form successfully, but I'm not finding a standard ATF test step that allows me to click the button directly. The button executes server-side logic that I need to validate as part of the test.

Has anyone implemented this before? What is the recommended approach to click a UI Action/button in ATF? Would this require a custom test step, client test runner, or another method?

 

Any examples or best practices would be appreciated.

 

Thanks!

7 REPLIES 7

vijaydodla
Giga Guru

Yes, there is a standard OOB ATF test step specifically designed for this, so you do not need to build a custom test step or use a custom client test runner.

To click a button on a form, you should use the Click a UI Action test step located under the Form category in ATF.

 

How to Configure the "Click a UI Action" Step

To successfully execute a server-side UI Action in your test, follow these steps:

  1. Prerequisite Step: Ensure you have already added an Open a New Form or Open an Existing Record step in your test. The form must be actively open in the Client Test Runner for the button to be clicked.
  2. Add the Step: Click Add Test Step, navigate to the Form category on the left, and select Click a UI Action.
  3. Configure the Step:
    • Table: Select the table where your UI Action resides (e.g., incident or change_request).
    • UI Action: Use the magnifying glass to search for and select the specific button you want to click.
    • Assert type: You can choose whether you want the step to successfully click the button, or assert that the button is not clickable/visible.

Please mark the post as Accepted Solution if the above content helped to resolve the issue. Thank you ! 

Ankur Bawiskar
Tera Patron

@Mmodi 

which form is this?

share screeshots of that form and your test steps

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

In the screenshot below, I would like to create an ATF step that will click on the Calculate Risk button but only after all the questions are filled up

RaghavendraGund
Tera Contributor

Hello @Mmodi 

I reproduced your scenario in my PDI.
There is a Standard step for this - Click a UI Action, under the Form Step Category

I created a Server Side UI Action, Just to replicate the scenario, what it does is when the user clicks on that UI Action, the incident form short description field gets updated(Refer Screenshot 1&2)
Refer Screenshot3& 4 for exact Test steps i used and screenshot 4 for the Test Results, Please follow the
exact steps I followed. your ATF will work.

Setup I used:

  1. Impersonate
  2. Open an Existing Record  Incident, INC0000059
  3. Click a UI Action Table: Incident, UI action: my server-side test action
  4. Record Validation  asserting the field the UI Action sets



Also, Please Mark helpful if my reply added any Value 

Regards
Raghavendra G