Create ATF based on condition query

SnowDevOps
Giga Guru

Hello

I have an clients fax catalog item and I want to build an ATF test for it. When the catalog item loads, it checks whether the current user has a fax number by querying a custom table. Based on the result, the form conditionally displays different fields. I’m not sure how to start building the ATF to test this behavior. Any idea or suggestion, let me know. Thanks for your help 

I'm looking at the step: Run server side script to query the (custom fax table) for an idea 

 

3 REPLIES 3

lauri457
Tera Sage

You haven't given enough information on how all this is implemented so I am assuming a little bit. If your query is a client callable script include I would probably just create a private parameterized method in the SI that handles the server side logic which can be tested separately if needed.

 

Then the ui/glideajax part can be tested separately in a test that follows this logic:

  1. create and impersonate user (+ set the values/create the artifacts needed for your fax number logic)
  2. open catalog item
  3. validate variable states assuming your check has run and changed the states at this point

Screenshot 2026-04-14 104820.png

Tanushree Maiti
Kilo Patron

Hi @SnowDevOps ,

 

Here is the steps :

Step 1: Generate a new user specifically for this test run.

Step 2: Add a record to your custom table.
    Link the User field in this table to the user created in Step 1 using a data pill.
    Enter a sample value in the Fax Number field.

Step 3: Impersonate the newly created user from Step 1.

Step 4: Open your Fax Catalog Item.
    Allow the form to load completely so that all client scripts finish retrieving data from the table.

Step 5: Confirm that the relevant fields are displayed or hidden according to the expected behavior.

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Ankur Bawiskar
Tera Patron

@SnowDevOps 

so what you started and where are you stuck?

You can use Run Server Side Script step and get the data and then compare

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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