ATF Test step to set url parameters.

Cecilia7
Kilo Contributor

I'm testing a SN catalog item. When a user gets directed to the SN form from another website, some parameters are passed through the URL and used to auto-populate the form. One of these parameters is the user's IP address, which is used to populate a field (and made invisible to the user) with a client side script:

var gUrl = new GlideURL();

gUrl.setFromCurrent();

var publicip = gUrl.getParam("sysparm_pip");

g_form.setValue('user_ip_address', publicip);

g_form.setDisabled('user_ip_address', true);

In an ATF test step, how would I set the url parameters for subsequent test steps so that I can validate that this field was populated automatically in the form?

 

 

1 ACCEPTED SOLUTION

Deepen Shah
Kilo Guru

Hello Cecilia,

 

Which ATF test step are you using? If you are using 'Open a Catalog Item (SP)' then it has Query parameters field to supply the parameter.

 

find_real_file.png

 

Regards
Deepen shah
aavenir.com

View solution in original post

9 REPLIES 9

I do not know exactly why 'Open a Catalog Item' step do not have query, but i think because this step is for platform where everything is taken care by SN hence only thing you can provide is 'View'.

Opening in Service Portal here is you've some customization and you might want to control it through query parameter.

Regards
Deepen shah
aavenir.com

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

since those variables are auto-populated when the form loads you can use this steps

1) open catalog item

2) validate variable value

Regards
Ankur

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

Cecilia7
Kilo Contributor

The problem is that the IP address isn't populated when I open the form from servicenow. URL parameters are passed when a client is linked to the Service Now catalog item from another domain. I'm trying to simulate those parameters and am wondering if it is possible with ATF.

Thanks,

Cecilia

Hi,

I believe anything outside of ServiceNow cannot be tested using ATF.

Since in your case user has a particular link and when that link is clicked user is taken to catalog item form of ServiceNow and then the variables are auto-populated; I believe it cannot be simulated.

Any ATF test step which has to be tested needs to be initiated within ServiceNow.

ATF allows you to create custom steps only for Server Side configurations.

https://community.servicenow.com/community?id=community_question&sys_id=53deb0c01b69b340ada243f6fe4b...

https://docs.servicenow.com/bundle/orlando-application-development/page/administer/auto-test-framewo...

Regards
Ankur

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

Hi

You can not interact with any page outside of servicenow. 

But what you can do is open catalog item and provide same URL parameter with some value and see if the auto populated value is same.

For e.g.

1. Open Catalog Item with URL parameter (ip=ipvalue)

2. Verify text(ipvalue) on the page. 

By assuming this URL parameter (which is actually going to be provide by page in another domain) at least you can make sure that catalog field is using URL parameter

Regards
Deepen shah
aavenir.com