JMeter Sequence

I have a JMeter test plan with the following HTTP request probers.

  • To come in
  • Calling up some functions that require a registered user
  • Exit

When I execute a test plan with 5 parallel threads, I see that sampler 2 is called before calling sampler 1 for some threads, which then does not respond to the response statements.

Is it possible to specify the sequence of samples that will be executed?

+7
source share
2 answers

This should ensure that they are executed sequentially:

enter image description here

So start with the thread group.

The number of threads (users) is 5.

So, suppose you have a logical job for your proxy server. Just add an additional sampler to it. So, right-click on this sample Add > Post Processors > BSF PostProcessor , inside this mail processor a large space script enter ${__setProperty(ThreadValue,${__threadNum},)} .

This will save the thread number in your property called ThreadValue . Make sure you select your language as beanshell in the drop-down list.

Then after the input probe adds an if controller. Add this to the condition field (${JMeterThread.last_sample_ok}==true) && (${__property(ThreadValue,,)} == ${__threadNum})

What does this mean that → do only login, until the actual login is successful, and if the login thread matches the thread you are currently in.

What do you do your login only inside the if controller. If you want to be sure that you are leaving the right place for the user, add it if the controller surrounds it.

Greetings

+10
source

What you need to consider is that each thread is a separate object, like a real user, and that it has its own session, but JMeter is designed to execute these threads asynchronously, i.e. in parallel. The listener of the result presentation tree displays all activity, from all threads, as it happens regardless of the sequence of logical threads. If you would prefer 1 thread to do 5 iterations, just change the number of threads to 1 and use a loop of 5 and this will keep the sequence (although this defeats the point of using a load testing tool like JMeter!).

If you change the number of threads by 1, you will see the true logical sequence in the result tree. This will show that each sampler is executed sequentially, from top to bottom.

Now, in your case, I suspect that you have a problem not because the situation is ending, but because the server is losing the session context between requests. This is very common, and most often you can solve this problem using the HTTP Cookie Manager or the Regular Expression Regulator .

+2
source

All Articles