Forum Discussion

richie's avatar
richie
Community Hero
8 years ago
Solved

Looping Test Case - write out REST response value from each loop for use later

Hi,

 

I'm struggling to actually describe what I need - it is a property transfer - but I want the values to persist after each loop to be used later.

 

I have a test case that sources .json files from a directory datasource - has a couple of POSTs in it, then loops around to use the next file in the directory.  A value in the first POST is used in the second POST - which is straightforward property transfer - this I can do.

 

Test Case hierarchy is as follows:

 

Datasource (Directorytype) sourcing multiple .json files (fileContents property)
POST1 (${DataSource #fileContents}
PropertyTransfer (${POST1#phonecallid})
Properties (phonecallid = 1234567)
POST2 (${Properties#phonecallid})
Datasource Loop

 

HOWEVER -as well as the phonecallid, there is another unique reference (entityid) that I need to grab from the POST1 request each time it executes for later use (I've simplified the test case quite a bit), so that if I have 10 .json files in my Datasource, I get 10 entityid values written somewhere.  If I do this as a propertytransfer, the value will be overwritten each loop iteration.

 

I need some way to grab the entityid value from each loop and save it somewhere for later (properties step, testsuite property, maybe a flat file) - but as I say - if do just a normal property transfer - the value will be overwritten each loop iteration.

 

have I just said the same thing twice?  told you I was struggling to explain!

 

I hope I've explained myself clearly!

 

thanks to all for any advice/guidance/tips/help anyone can provide!

 

richie!