JMeter __threadNum function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.
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:
\${__threadNum}returns a number between 1 and the max number of running threads configured in the containing Thread Group
Example
Section titled โExampleโ${__threadNum} โ e.g. 3 for the third thread startedCombine 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.