Skip to content

__threadNum

JMeter __threadNum function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.

Difficulty
intermediate
Guide type
reference
Estimated read time
1 min read
Last verified version
Verified JMeter 5.6

Also documented in context in the full Functions and Variables reference.

TL;DR: __threadNum returns the current threadโ€™s number (1, 2, 3, โ€ฆ) within its Thread Group โ€” useful for deriving per-thread test data (e.g. user${__threadNum}) without a CSV file.

The thread number function simply returns the number of the thread currently being executed. These numbers are only locally unique with respect to their ThreadGroup, meaning thread #1 in one threadgroup is indistinguishable from thread #1 in another threadgroup, from the point of view of this function.

There are no arguments for this function.

Usage Example:

Terminal window
\${__threadNum}

returns a number between 1 and the max number of running threads configured in the containing Thread Group

${__threadNum} โ†’ e.g. 3 for the third thread started

Combine with __threadGroupName when a test plan has multiple Thread Groups and per-group-scoped IDs are needed. For genuinely unique values across a distributed run (multiple injectors), prefer __UUID โ€” thread numbers restart from 1 on every injector.

On this page