...
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.
Steps:
First create a utility method say pushValueToArray like this.
You may use the below code for the utility method `pushValueToArray`Code Block language js title pushValueToArray linenumbers true (function(){ var aFunction = function(res, opts, arr, val){ if(!arr) arr = []; arr.push(val); return arr; }; return aFunction; })();
- Then in variable extractor tab of the test case, extract the desired properties of the response, as you do normally for the current iteration. In this sample demonstration, we want to extract the _id property of the API response.
- Now, for each extracted property, create another variables e.g. plural version of variables and invoke the utility method like this.
Note:- In pushValueToArray, first argument ({{contactIds}} or {{names}}) must not be enclosed with double quotes.
...