My Scenario. [ All are in Same Thread group] I have to Create Cart, Add Multiple Items(5), Update few items(1) and then checkout.
Add Items - I have to add 5 Items [ Each Item will generate unique Item ID] Using For Loop to add 5 times and capture the Item ID value using JSON Extractor. Variable Name= C_Item_ID
JSON Path Expression= $.items[0].id
In JSR223 Postprocessor, i having the below code
def count_value= vars.get("cnt").toInteger(); //convert to int type
For each loop iteration i am capturing the Item ID and store it different variable
switch (count_value) {
case 1:
def C_Item_ID_1 = vars.get("C_Item_ID");
vars.put("C_Item_ID_1",C_Item_ID_1);
break;
etc....
}
Update Item - I need to passing the unique Item ID here.
ex. xxx-service-xxx/cart/1234567890/items/${C_Item_ID_1}
When i reply "${C_Item_ID_1}" value is not getting here.
Not sure what is wrong on this? Any help?