Step 1: Add a post processor regular expression extractor to your get and all order Ids .Use Match no -1 to store all order Ids.Assume that the name of the created variable is “Orders”

Step 2: Add a Beanshell pre-processor to your Post HTTP request and add the following code to the preprocessor

int count = Integer.parseInt(vars.get("Orders_matchNr"));

String delimiter = ",";
StringBuffer sb = new StringBuffer();
for(int i=1;i<=count;i++) { 
sb.append(vars.get("Orders_" + i));
if (i == count){
break; //to eliminate comma after the 
 }else {
 sb.append(delimiter);
 }
}
vars.put("arrayOutPut",sb.toString());

use [${arrayOutPut}] to as an array

enter image description here
enter image description here

For more information on extracting variables follow this link



Source link https://sqa.stackexchange.com/questions/34110/how-to-extract--from-one-http-request-and-pass-as-an-array-to-the-next-htt

LEAVE A REPLY

Please enter your comment!
Please enter your name here