Can we Select The Related List Record in Automated Test Framework

prasadyellanur
Kilo Contributor

Hi ,

I am working on the automated test framework.i am facing the following issue with Test Steps..

Ex:

--open incident record form .

--navigate related list.

-- selecting (or) click on the SLA Record.

how to achieve this with the Automated Test Frame Work...

4 REPLIES 4

Shahed Shah1
Tera Guru

Currently there is no test step to navigate to a list/related list and select a record. I know how painful that is.



Having said that, you could look at scripting this particular stage, by:


  • Using a sys_id input from the Incident of interest
  • Do a lookup to the task_sla table
  • Query it where the task field have the value of the supplied Incident's sys_id
  • Randomly select a record


You probably would end up with a script along the lines of:


function getAssociatedSLA(sys_id) {


  var tbl = new GlideRecord("task_sla");


  tbl.addQuery("task", sys_id);


  tbl.query();


  gs.info("Task SysID: " + sys_id);




  var recCount = tbl.getRowCount();


  gs.info("recCount: " + recCount);




  if (recCount == 1) {


      tbl.next();


      gs.info("SLA sys_id: " + tbl.getUniqueValue());


      gs.info("SLA Definition: " + tbl.getDisplayValue("sla"));


  }


  else if (recCount > 1) {


      var randomRecord = Math.floor(Math.random() * recCount);


      tbl.setLocation(randomRecord);


      gs.info("SLA sys_id: " + tbl.getUniqueValue());


      gs.info("SLA Definition: " + tbl.getDisplayValue("sla"));


  }


  else {


      gs.info("No SLAs found")


  }


}


getAssociatedSLA("sys_id_comes_here");




Then you turn this into a scripted step by referring to Creating reusable custom scripted steps in ATF .



This is all theory, but I hope this sets you in the direction of fulfilling your requirements.


hi Shahid Shah,



Thanks for the Reply .



Through the "record query" i am getting the list of the sla records .


but from the UI form i need to select and need to open that sla record form by clicking on the sla record.


from the script   only i can get the count..


Hi, as of now in ATF you cannot open related list record.



Instead you can add following steps   -



1 - "Record Query"   and put query such a way that you narrow down the search that contains only required result.



2- Open existing record



For example - for a change request, as an approver , I cannot approve using related list, so i followed below steps -


1- query the sysapproval_approver table , gave query that narrowed required results.


2- open existing record


3- select approve.


Hello Prasad,



I would agree with the other fellas regarding the statements that we cannot use ATF tests to populate Related Lists the way users do. At least, not for now.

However, you can still operated with Related Lists via an ATF test:

- If you would like to populate an empty Related List for example, I would advise you to configure your ATF test in a way via which it can access the relationship table (the one of the Related List), open new form in it, populate it in a way via which it can be linked to the main record, and then submit it.
For example, you may use steps such as: open a new form (in the RL table); set values in the new form (here, if there is a Task field - then, you may populate it with the number of the main record); submit the current form (once the form gets submitted and entered in the DB as a record - it will be linked to the main record of yours and this way your Related List will get populated accordingly);

- If you already have a Related List which contains at least one record - then (for example: such which requires approval), you may access it by using steps in your ATF test, such as: Record Query(to find the respective record in the Related List table, which correspond (included in the RL) to the main record), Open an Existing Record (once you find at least one corresponding record you - the test will open it for further operations), Set Field Values (via this step you can perform changes, for instance: set the 'State' of the record to 'Approved') and Click a UI Action (to Update or Save the changes);


Best Regards,
Georgi Mavrodiev

IT Consultant,
Do It Wise Ltd.

You may visit us in our Web Site: www.doitwise.com