Using a Property in JMeter to reference environment dependent data

on 27 February 2023 CI, DEVOPS, JMETER, LOAD_TESTING, PERFORMANCE with 0 comments

What is a property ?

In JMeter, a property is a key-value pair that is used to store configuration settings and other data. This data can then be referenced by other elements in your test plan (CSV DataSet for example).

Properties are defined at the test plan level and can be accessed by any element within the test plan. Properties can be used to configure various elements in your test plan, such as the number of threads, the ramp-up time, and the duration of the test.

Defining a property

Properties can be defined in several ways in JMeter:

1) User Defined Variables :

Properties can be defined as user-defined variables in the “User Defined Variables” element. This is a simple way to define and manage properties within your test plan.

2) Command-line options :

Properties can be set using command-line options when starting JMeter. For example, you can set the number of threads using the -J option, like this:

jmeter -JnumThreads=10

3) Properties file :

Properties can be defined in a properties file, we usually use (which is provided by default by JMeter for such purpose). This file can then be loaded into JMeter using the -q option. For example, if you add to your file the below code :


Then, you can load this file into JMeter using the following command:

jmeter -p -q

Using a property

Once a property is defined, it can be referenced by other elements in your test plan using the ${__P} function.

For example, if you define a property named “numThreads”, you can reference it in a Thread Group element like this:


Note you can add a default value like this, we define below that numThreads will be equal to 10 if property is not explicitly defined by user:

${__P(numThreads, 10)}

About UbikLoadPack :


Other links :