This guide will help you to extract variables of a test case having a loop.
Suppose we have a test case to validate the Add contact API and we are executing this test case in a loop.
And we want to extract the contact ids and names of all the newly created contacts and we want to store them in array say contactIds and names respectively.
First create a utility method say pushValueToArray like this.
You may use the below code for the utility method `pushValueToArray`
(function(){ var aFunction = function(res, opts, arr, val){ if(!arr) arr = []; arr.push(val); return arr; }; return aFunction; })(); |