https://bz.apache.org/bugzilla/show_bug.cgi?id=62752
Bug ID: 62752
Summary: Add to Documentation: ctx.getThreadNum() 0-based and
${__threadNum} 1-based
Product: JMeter
Version: 5.0
Hardware: PC
OS: Linux
Status: NEW
Severity: minor
Priority: P3
Component: Main
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: JMETER_5.1
ctx.getThreadNum() returns a 0-based thread number,
the variable __threadNum is 1-based
Reproducible in JMeter 4 and 5 with a simple test plan:
a thread group,
a constant throughput timer
a JSR223 sampler which just logs
log.info("from ctx:"+ctx.getThreadNum())
log.info("from variable: ${__threadNum}")
in jmeter.log I see for example for the first thread
2018-09-18 22:45:07,610 INFO o.a.j.t.JMeterThread: Thread started: Thread Group
1-1
...
2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from ctx:0
2018-09-18 22:45:08,085 INFO o.a.j.p.j.s.JSR223Sampler: from variable: 1
It's probably late to change this without potentially breaking backward
compatibility, so a documentation update can be used to clarify this small
inconsistency
Documentation for ctx.getThreadNum
http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterThread.html#getThreadNum--
Documentation for the JMeter variables
http://jmeter.apache.org/usermanual/functions.html#__threadNum
--
You are receiving this mail because:
You are the assignee for the bug.