ATF test how to open a related list record using ATF

Meroda Gezahegn
Tera Contributor

I want to test that the related list record is opening correctly and validating the values using ATF but both the 'Validate Record in the List' and 'Open a Record in List' test steps are failed basically when I try to configure the steps  the dot walking is not even bringing the data correctly.

in my case I am using incident form and approval table as related list and here I want to open the approval record using ATF

Remember that I am not trying to test the existing record but a record which is generated in a flow that means I do have a flow when something changes the approval request is going and the record under the approval is created and I want to open the newly created record using ATF related list test steps

1 ACCEPTED SOLUTION

@Meroda Gezahegn , Thanks for the information. Got it now. In this case you can try with first Run server side script step  with below code.

Note:

1) Ensure you give valid step sys_id i.e. the sys_id of step which submits the incident.

2) Ensure in the next step you use Impersonate User Step and Select the output of this Run Server Side Script step i.e. record_id.

(function(outputs, steps, params, stepResult, assertEqual) {
   

var incRecordSysId = steps('sys_id_of_step').record_id; // give here the step sys_id for submit form of incident
// Get incident's assigned to 's manager
var gr = new GlideRecord("incident");
gr.addQuery('sys_id', incRecordSysId);  
gr.query();
if(gr.next()) {

var assigned_to_user = gr.assigned_to;

var grUser = new GlideRecord('sys_user');
grUser.addQuery('sys_id', assigned_to_user);

grUser.query();

if(grUser.next()){

outputs.table = 'sys_user';

outputs.record_id = grUser.manager;

stepResult.setOutputMessage("Incident Assigned to manager found " + grUser.manager);

stepResult.setSuccess();

return true;

}

else{

stepResult.setOutputMessage("Failed to find right user");

stepResult.setFailed();

return false;

}
}
})(outputs, steps, params, stepResult, assertEqual);
 
Hope it helps. Kindly mark helpful/accepted if it assists you.
Regards,
Priyanka Salunke.

View solution in original post

8 REPLIES 8

@Priyanka_786 

Hello Priyanka,

Same approach i have implemented in our requirement as given code 

function(outputs, steps, params, stepResult, assertEqual) {
    // add test script here
var mmRecordSysID = steps('3a66daa9c3e21a50773116977a01314b').record_id; // Submit form step sys_id taken here 
var mmgr = new GlideRecord('x_fu_mast_main_request');
mmgr.addQuery('sys_id',mmRecordSysID);
mmgr.addQuery('status','completed');
mmgr.query();
if(mmgr.next()) {
 
var grLog = new GlideRecord('x_fu_np_lv_import_log');
grLog.addQuery('request_number',mmRecordSysID);
grLog.addQuery('level','info');
grLog.query();
if(grLog.next()){
 
outputs.table = 'x_fu_np_lv_import_log';
outputs.record_id = grLog.message;
stepResult.setOutputMessage("The import Log Message is" +grLog.message);
stepResult.setOutputMessage("Successfully Log generated");
 
        stepResult.setSuccess();
 
return true;
 
}
 
else{
 
stepResult.setOutputMessage("Failed to find message");
 
stepResult.setFailed();
 
return false;
 
}
 
}
 
the Run server sidestep executed successfully but the message not displaying could you please check the code?

 

 

@Priyanka_786 

 

Attached Run Server sidestep results 

@Khalid9030 : As per the provided code, syntax looks correct. Please confirm once "grLog.message" getting right value which is used in message line.

 

Please mark my response as helpful/correct if it helps.

 

Regards,

Priyanka Salunke.

nickpqa
Tera Contributor

Hi,

 

To answer to your question to

1) Need to use 'Related list' step first to clickon 'edit' andor 'new' button

2) Need to use Click UI component for your query and drag your selection from left to right and Save ( use  Component Values (Custom UI)  and Click Component (Custom UI) steps)

 

Attached the screenshot for your reference. Please contact me directly as an ATF expert / Architeh I can help you with. 

 

nickpqa_1-1737671751413.png

 

 

nickpqa_0-1737671566982.png

 

 

 

If my response has resolved your query, please consider giving it a thumbs up ā€Œā€Œ and marking it as the correct answerā€Œā€Œ!

 

Thanks

Nayan Patel

If my response has resolved your query, please mark it Helpful by giving it a thumbs up and Accept the Solution