Forum Discussion
1. To fetch and write to property step, I am using groovy:
import groovy.json.*
def api_response = context.expand( '${APIstep#Response}' ).toString()
def json = new JsonSlurper().parseText (api_response);
def MAX_LIMIT = 3
def IDs = new Object[MAX_LIMIT]
IDs[0] = id_1 = json.id[0].toString().replaceAll("[^a-zA-Z0-9 ]+","");
IDs[1] = id_1 = json.id[1].toString().replaceAll("[^a-zA-Z0-9 ]+","");
IDs[2] = d_1 = json.id[2].toString().replaceAll("[^a-zA-Z0-9 ]+","");
int i=0;
while (i<3)
{
if (i<3)
{
testRunner.testCase.getTestStepByName("Properties").setPropertyValue("testID",IDs[i]);
log.info IDs[i]
}
i++;
}
2. Then I am passing that value from property to API2 URI using ${Properties#testID}
These steps only keep the last id value. I added a datasource loop step in the end but it does not help either