Alex Le
Alex Le

Reputation: 113

Create unique props variable for each thread in Jmeter

I want to create properties variable for each Thread and this is unique and i can use it in another input. So does anyone can suggest me the way to do it? Is __threadNUm is the easiest way to do it?

Upvotes: 1

Views: 749

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

  1. In order to set the property you can use __setProperty() and __threadNum() functions combination like:

    ${__setProperty(PROPERTY_PREFIX_${__threadNum},PROPERTY_VALUE,)}
    

    Replace PROPERTY_PREFIX and PROPERTY_VALUE with your own values

  2. To read the property value per thread you can use __P() and __threadNum() functions combination like:

    ${__P(PROPERTY_PREFIX_${__threadNum},)}
    

Demo:

enter image description here


Another solution is using Inter-Thread Communication Plugin which is handy for sharing values across different threads (even if they are in different thread groups). The exact instructions will differ depending on what you're trying to achieve, you can see SynchronizationExample.jmx test plan for reference.

You can install Inter-Thread Communication Plugin using JMeter Plugins Manager

enter image description here

Upvotes: 1

Related Questions