ATF Scripting

mariavic1998
Tera Contributor

Hi everyone, I want to verify if an approval is generated for a request with an ATF step, do you know if this can be done with the current available steps or it has to be with scripting? throught the 'Run Server Side Script'

1 ACCEPTED SOLUTION

Hemanth M1
Giga Sage
Giga Sage

Hi @mariavic1998 ,

 

You can do with available test steps, 

1)I assume you already have a step to find the request subnitted.

2)Use Server> Record query> Query "sysapproval_approver" table with approval for = Submitted Request and State is Requested

If Approval exist AFT run will be sucessful if not if will throw error saying no record found.

 

Hope this helps!!!

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

4 REPLIES 4

Hemanth M1
Giga Sage
Giga Sage

Hi @mariavic1998 ,

 

You can do with available test steps, 

1)I assume you already have a step to find the request subnitted.

2)Use Server> Record query> Query "sysapproval_approver" table with approval for = Submitted Request and State is Requested

If Approval exist AFT run will be sucessful if not if will throw error saying no record found.

 

Hope this helps!!!

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

The logic, is that the approval shouldn't be created, this also applies in that case?

You can use the Assert type field, 

1.If 1st choice is selected. The step will pass if an approval record is found and will get failed if approval record is NOT found.

2.If 2nd choice is selected. The step will pass if an approval record is NOT found and will get failed if approval record is found.

 

Chidanand_0-1736251080602.png

 

Swaraj Bhandare
Tera Contributor

@mariavic1998 You can simply query the approval table to check the approvals are created or not,  either it will be a situation where you want to check approvals created or approvals not created.

 

Plase click on thumb Icon if my response was helpful and answers your question.