Reputation: 243
I´m working on a JMeter testplan which is meant to preformance-test a webservice. The main part of the whole testplan consists of two steps.
If I use a singlethreaded plan, everything works out as expected, but as soon as I use more than one thread, then assetId will have last thread value and remaining values will be missed out. Could you please let me know how I can access/store all assetId in delete call
Upvotes: 0
Views: 635
Reputation: 168072
You're overwriting the same property by each consecutive thread, you need to do something like:
In the first step change your code to:
props.put("assetId_" + ctx.getThreadNum(), vars.get("assetId"));
In the second step use the __groovy() function to read the property value:
${__groovy(props.get("assetId_" + ctx.getThreadNum()),)}
Also be aware that starting from JMeter 3.1 you're supposed to be using JSR223 Test Elements and Groovy language for scripting so consider migrating to JSR223 Assertion with Groovy.
Upvotes: 0
Reputation: 983
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.
You should use the variable name of your JSON extractor instead of creating a property to avoid sharing the variable between threads.
Upvotes: 2