Search code examples
performancejmeterbeanshelljmeter-5.0

In Jmeter variable value is getting overridden with next thread value


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.

  1. Create one of these asset ID (via Post-request) - extracting asset ID by JSON extractor and setting variable using bean shell assertion ${__setProperty(assetId,${assetId})}
  2. Delete created asset by ID (Delete request) - ${__property(assetId)}

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


Solution

  • 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.