Reputation: 484
JMeter's behavior doesn't make sense here at all. A minimized version of my project looks like this:
Thread group
- Outer PreProcessor
- Outer web request
- Loop controller
..- Inner PreProcessor
..- Inner web request
With a thread and loop count of 1 on the Thread group and a loop count of 6 on the loop controller, I would expect Outer PreProcessor to run once and Inner PreProcessor to run 6 times (in each case, the same number of times that the associated web requests run).
Instead, outer runs 7 times, and inner runs 6 times (as determined by console logging). It doesn't make any sense with the project structure, and those extra PreProcessor runs seem to be messing up my variables.
Why would JMeter do things this way, and how do you make it stop?
Upvotes: 2
Views: 730
Reputation: 58774
In your particular use case, you need JMeter PreProcessor to be a child of a Sampler and not under thread group or test plan. Try to use this convention or move code to Sampler or use JMeter functions.
Upvotes: 4
Reputation: 167992
JMeter Pre Processors are following Scoping Rules, i.e. Pre Processor will be executed for all samplers which are located on the same level (or lower).
Therefore:
Outer PreProcessor
preprocessor will be run for Outer web request
and for Inner web request
Inner PreProcessor
will be run for Inner web request
(as well as for all requests on the same level)Solution will be moving Outer PreProcessor
to be a child of the Outer web request
.
More information: A Quick Guide to JMeter PreProcessors
Upvotes: 3