Reputation: 539
We are using Jmeter 5.1.1
v to perform load testing, Our scenario is get 25 tokens from Setup thread group
(Threads set to 25 with rampup 25 secs under SetUp Thread group
), then having a normal Thread group
which contains HTTP Sampler
and in this Sampler need to pass those 25 tokens for each 1 thread hence this Thread Group contains configuration of 25 Threads with 25 Secs.
However when Run the test, 25 tokens been generated but only the last 25th token used for all threads (using the 25th token). Trying to get for each Thread should get one token value, if 2nd thread then 2nd token should be used.
Below is the Structure:
TestPlan
--SetUp Thread Group - 25 Threads, 25 Secs
---HTTP Sampler - Gets the Token here using RegEx and Set the value as Property using Beanshell Assertion
O/P: Got 25 tokens generated, and set in the property value
--Thread Group - 25 Threads, 25 Secs
---HTTP Sampler - Get Token value as property
O/P: Only the 25th token been used for all 25 threads
EDIT
Tried answer and got error:
Upvotes: 1
Views: 257
Reputation: 168122
Not knowing how do you pass the tokens between Thread Groups it's quite hard to tell what's wrong, a "blind shot": you're using a single JMeter Property which is being overwritten.
The solution is to make the token thread-specific, for example you can set it like:
props.put("token_" + (ctx.getThreadNum() + 1), vars.get("variable from regex here"));
and then read it using __P() function like:
${__P(token_${__threadNum},)}
Few more hints:
Upvotes: 1
Reputation: 58812
Create token inside same thread group, if you do not want to consider for results,
You can ignore token sampler by adding JSR223 PostProcessor with the line prev.setIgnore()
prev - (SampleResult) - gives access to the previous SampleResult
Upvotes: 2