ATF

Nag9
Tera Expert

How to create ATF test in servicenow

7 REPLIES 7

Hi Akash,

 

The code is working properly but i have to include the URL also in that code 

(https://xxxx.service-now.com/$m.do#/home),  if i opens this one it shows 

 

 

I want to test this url, please provide the soltuin for this

Hi Nag,

You can include a line before proceeding to steps, something like this:

1. var url = "https://dev55511.service-now.com/$m.do";
2. if(isValidURL(url)){

The full script is here:

(function(outputs, steps, stepResult, assertEqual) {
	// add test script here
	var url = "https://dev55511.service-now.com/$m.do";
	 if(isValidURL(url)){
		var list = ['My Incidents','Knowledge','Location','My Requests','Service Catalog','My Approvals','Favorite KPIs','Connect'];
		var gr2 = new GlideRecord('sys_ui_mobile_home_page_section');
		gr2.query();
		while (gr2.next()){
			var gr = new GlideRecord('sys_ui_mobile_home_page_module');
			gr.query();
			while (gr.next()){
				stepResult.setOutputMessage("The module found in Homepage is"+gr.title);
				gs.log('Found 1 module'+gr.title);
				for (i=0;i++;i<(list.length)-1){
					assertEqual({name: "Checking Module Name", shouldbe: list[i], value: gr.isValidRecord()});
					}}// pass the step
					
					return true;
				}
			}
	else
		return false;
			
		})(outputs, steps, stepResult, assertEqual);
		// uncomment the next line to execute this script as a jasmine test
		//jasmine.getEnv().execute();
		

Thanks, Akash.

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

its not working tests are failed