ATF - Notification validation

Community Alums
Not applicable

Email notification has been configured for creation of enhancement record. I am creating an enhancement record from below steps.

find_real_file.png

I want to validate whether the notification has been triggered or not for enhancement record created from step 3. Also I want to validate notification is triggered to assigned to of enhancement record. Could any one suggest me how I can achieve this through ATF?

Also please inform me how I can query enhancement number from ATF?

1 ACCEPTED SOLUTION

This would be your code:

 

(function(outputs, steps, stepResult, assertEqual) {
    var gr = new GlideRecord("rm_enhancement");
    var num = steps('60f29ef0dbf527006d3c72fc0f961959').record_id; //Sys Id is mentioned here is previous step sys_id. 
gr.addQuery('sys_id',num);
gr.query();
if(gr.next())
{

    outputs.record_id = gr.number; //(replace with field name of number)

    }
    // add test script here

})(outputs, steps, stepResult, assertEqual);

View solution in original post

16 REPLIES 16

Community Alums
Not applicable

Hi Nitesh,

I tried this method but if I am trying to query 'submitted from the previous step' its giving sys Id as a output and email subject contains the enhancement number. As a result Test case is getting failed.

I want to get enhancement number from that sys_id. Any suggestions!

In the serverside step, just glide into the enhancement table, query by the sys_id that you got from the previous step, find the record and then pull the number from it.!

You can use record_id as the output variable to store the number or you can go to sys_atf_step_config table and open the serverside script step, and create another output string variable, doing this is a good idea so that you can use this variable in the future for different purposes if anything you want store anything greater than 32 characters.

Community Alums
Not applicable

Hi Nitesh,

I wrote the below script in 'server side script' step.

(function(outputs, steps, stepResult, assertEqual) {
    var gr = new GlideRecord("rm_enhancement");
    var num = gr.get(steps('60f29ef0dbf527006d3c72fc0f961959').record_id); //Sys Id is mentioned here is previous step sys_id.
    outputs.record_id = num.getDisplayValue();
    
    // add test script here

})(outputs, steps, stepResult, assertEqual);

I know I am doing something wrong in the script to get enhancement record number But when I ran the Test Case this particular step executed successfully.

Below this I used 'Open an existing Record' step as below

find_real_file.png

But Test case got failed by giving an error as below

find_real_file.png

Got this to work! Here's how you do it. Please modify with your table.

 

(function(outputs, steps, stepResult, assertEqual) {
    // add test script here
	
	var a=new GlideRecord('incident');
	var getid= steps('9ff2533cdbf1e30075dd9837db961917').record_id;
	gs.info("number is "+getid);
	a.addQuery('sys_id',getid);
	a.query();
	if(a.next()){
		
		gs.info("number is "+a.number);
	}
	

})(outputs, steps, stepResult, assertEqual);

This would be your code:

 

(function(outputs, steps, stepResult, assertEqual) {
    var gr = new GlideRecord("rm_enhancement");
    var num = steps('60f29ef0dbf527006d3c72fc0f961959').record_id; //Sys Id is mentioned here is previous step sys_id. 
gr.addQuery('sys_id',num);
gr.query();
if(gr.next())
{

    outputs.record_id = gr.number; //(replace with field name of number)

    }
    // add test script here

})(outputs, steps, stepResult, assertEqual);