Problem The JSR223 shifts its processing. On the first ForEach iteration I expect the JSR223 to produce a given value, but I see that expected value on the debug postprocessor of the following interation instead. Why is this happening?
Scenario I have a set of companies (thread group). Each company has a set of Stores (ForEach #1). Each store has a set of "location groups" (ForEach #2). Each location group has its own type.
The location group type is a numeric value, from 1 to 12. Let's say the ForEach controller iterating these location groups produce this sequence of types: 6, 9, 5, 11, 7, 12, 10 and JSR223's code is as follows:
if (vars.get("locationGroupType") == "6"){
log.info("Store:" + vars.get("anUnit"))
log.info("location group ID:" + vars.get("aLocationGroupId"))
vars.put("aux", "SIX")
log.info("location group type:" + vars.get("locationGroupType"))
}
if (vars.get("locationGroupType") == "9"){
log.info("Store:" + vars.get("anUnit"))
log.info("location group ID:" + vars.get("aLocationGroupId"))
vars.put("aux", "NINE")
log.info("location group type:" + vars.get("locationGroupType"))
}
I would expect aux to be SIX on the first iteration, then NINE on the second.
Output This is JSR223's output to console: Console output You can see the store 292 has a location group id of 3803 which has a type value 6. But this information is NOT correct.
Request output for location group id 3803, which has a type value of 9: location group 3803 response Debug postprocessor dump where I can see 'aux' set to SIX: debug postprocessor
Oddly enough, the previous request to 3803 is the one that has the type value 6, and this is where I expect aux to be SIX: Response for 3635 where the type value 6 is found And the debug postprocessor for 3635 showing 'aux' to be empty: enter image description here