The CreatorCon Call for Content is officially open! Get started here.

Automated test framework: how to use REST inbound api response as input to next test step

mayurk
Tera Contributor

Hello,

I am working on writing ATF test cases where one of the step is to hit inbound rest api which will create Request in sc_request table. I am getting response in json format which includes request number. I want to parse the response to separate REQ number and use it in Record query test step and update some fields on REQ record. 

I am not sure how can i use REST response as input for next test step.

if anybody done this sort of thing before please let me know.

Thanks.

1 ACCEPTED SOLUTION

Ct111
Tera Sage

Hi,

Check this link it has steps

https://docs.servicenow.com/bundle/london-application-development/page/administer/auto-test-framework/reference/atf-rest-steps.html

 

and let me know if it helpds

 

Mark my ANSWER as CORRECT and HELPFUL if it helped.

View solution in original post

3 REPLIES 3

Ct111
Tera Sage

Hi,

Check this link it has steps

https://docs.servicenow.com/bundle/london-application-development/page/administer/auto-test-framework/reference/atf-rest-steps.html

 

and let me know if it helpds

 

Mark my ANSWER as CORRECT and HELPFUL if it helped.

Divya90
Tera Contributor

Hi,

Unable to open the provided URL.

Could you plz help me with something else (facing the same issue).

David Stutter
Tera Guru

I think you have to create you own Test Step Config for your case.

https://docs.servicenow.com/bundle/london-application-development/page/administer/auto-test-framework/reference/atf-step-config-record.html

 

Create the correct input variables and output variables in your step configuration.

 

You have to trigger the rest message per code, the easiest code generation for this is through the rest message -> http method -> Preview Script Usage

Just parse the response text body with JSON.parse, fetch your data and write them in your outputs.variables.

 

Look into other test step configs with "class type is script" to see how it should be used.

https://[INSTANCE]/sys_atf_step_config_list.do?sysparm_query=class_type%3Dscript