Reputation: 23
I am creating a JMeter test plan in which I need to execute several times the same request. For each request execution, I have a beanshell script that does some specific logic and increments a counter in a specific situation. The problem is that when I add a beanshell assert to check if the value is according I expect, this assertion does not wait for the loop to finish, and executes before.
Any idea on how can I make JMeter executes an assertion only after the loop has finished?
Upvotes: 2
Views: 1086
Reputation: 168197
JMeter assertions obey JMeter scoping rules, they are applied to the sampler(s) which are in their scope.
So if you want the assertion to be executed after the loop finishes - you need to add another sampler which will be doing nothing, i.e. Dummy Sampler and add your final assertion as a child of this sampler.
Also be aware that starting from JMeter 3.1 it is recommended to use JSR223 Elements and Groovy language for scripting so make sure to migrate from Beanshell on next available opportunity
Upvotes: 1