Using a ''requester'' role, I need to execute a scenario that will send a notification to another role to perform other actions. This scenario will act like a trigger of other two.
After all the notifications are sent (+100) I have to execute another two scenarios, for which 50 requests will be approved and 50 will be rejected.
How can I execute this scenario in such a way that the trigger scenario finishes first, so then I can perform the other two scenarios?
A timer can help for this case without affecting the load?
If you have all requests under the same Thread Group you could use a Flow Control Action sampler and Synchronizing Timer combination.
Add Flow Control Action sampler as the last sampler of the "requester" scenario (whatever it means) and set the "Number of simulated users to group by" to be equal to the number of threads in your Thread Group.
If "scenarios" are spread between different Thread Groups - take a look at Inter-Thread Communication Plugin.
Related
I calculate some statistics (e.g. average request duration) while my tests are running using code similar to this:
https://stackoverflow.com/a/27446405/2173353
However, I want to know when the test is done running (all the samplers have executed), so that I act upon the statistics then, and not before that. Essentially, I want to assert on the average duration of the requests when all requests are done.
Is there a way to execute code when the test is about to finish?
You must probably be looking for the tearDown Thread Group. It is some form of "special" thread group, the difference from "normal" Thread Groups is that the tearDown Thread Group is being executed after all other Thread Groups therefore you will be able to perform your "near the end" actions there.
More information: How to Use the SetUp Thread Group in JMeter When Preparing a Load Test
Building a test plan in JMeter. I have different Transactions and each of them has number of HTTP samplers and "if conditions".
So basically each user might not perform the same action based on the "if condition". I want all the users to start performing the same transaction at the same time and also wait for the other users(Threads) if they have not reached to the current transaction.
I know that I can achieve this with the help of Synchronizing timer but somehow I am not able to achieve this with it.
How to achieve it with any possible method ?
PS - I just want the threads to start transaction at the same time. it does not matter if they performing same sampler or not.
I can suggest another approach,
You can use tearDown Thread Group,
execute after the test has finished executing its regular Thread Groups.
After all threads are done you execute tearDown and can execute anything you want, including Module Control which can reuse transaction from your main thread group
It is quite hard to guess what's going wrong without seeing your Test Plan structure. Just in case be aware that Timers obey Scoping Rules so if you want a request to be executed by N threads in parallel - you need to put the Synchronizing Timer as a child of this request.
See Using the JMeter Synchronizing Timer article for comprehensive information and example test plan.
Assume I have two users in Thread Group and want them to fire two requests simultaneously. User 1 - HTTP Request A and User 2 - HTTP Request B.
Any ideas how to implement that ?
To trigger the requests simultaneously, you need to place your each requests in different thread group as shown below.
Also, make sure that in the Test Plan, below option is unchecked.
Above settings will execute the request simultaneously. Below is the sample output.
Just add Synchronizing Timer to your Thread Group and set Number of Simulated Users to Group by to 2 like:
The Synchronizing Timer will pause the first thread until second one is ready to execute the HTTP Request sampler so both threads will be run simultaneously. See Using the JMeter Synchronizing Timer article for more details.
I want to simulate a scenario in which a page contains multiple requests for differ data. All runs concurrently. I created a Thread Group with all those requests and ran it for 10 users(Threads) in 0sec ramp up time. But in this Test Plan all users starts concurrent but they all process requests in sequential way i.e.(always completes first request then starts 2nd,then third,so on).
I want that all requests of each user starts at same time then completes according to their response time (Like if 3rd takes less time than first then it should complete before 1st and 2nd). I have tried Synchronize time.
I don't think it is possible at the moment, the relevant enhancement is being tracked as Bug 53159
In the mean time you have 2 options:
Use different Thread Groups to kick off the requests. If you need to synchronize the requests you can use i.e. Inter-Thread Communication plugin.
Develop some custom code using JSR223 Sampler or even create your custom sampler, see How to Load Test AJAX/XHR Enabled Sites With JMeter for details on how this can be done.
How to send the consecutive HTTP requests in JMeter? The consecutive requests means that the new request will be sent after the previous one's respond arrived.
Simply set "Run Thread groups consecutively" check-box in the Test Plan element's (root element) details enabled.
This is default JMeter behavior within a single thread group.
If you have multiple thread groups, you can set the groups to run Consecutively or Concurrently by modifying the Test Plan options.