How to handle refresh token in Jmeter - jmeter

I have a setup thread group to authenticate and set a auth header property. The next thread group is for http request (the thread groups runs sequentially). However, after 15 minutes, I will need to refresh the token.
I don't want to send multiple authenticate request un-necessarily. Is there any way, I can add two thread groups and have only the auth request re-run every 10 minutes whereas the other http request run repeatedly.

Run Thread Groups in parallel
Make the "token" Thread Group to loop forever
Ensure that "token" request is being executed each 10 minutes by adding Flow Control Action sampler configured to sleep for 9 minutes 50 seconds or something like this
Token can be passed from one thread group to another using __setProperty and __P() functions or Inter-Thread Communication Plugin

Related

Can we re-call another Thread Group if the existing thread Group throw error in jmeter

Due to the limitation of Test Users Ids, we were only running the test with 3 Test Ids, these Test Ids can have max 1 session, if we login manually on another browser or machine it will kill the existing session.
Based on this limitation, I used Setup Thread Group to login, Teardown Thread Group for Logout and Thread group where I searched a few Items. On this Thread Group, I was successfully able to execute 20 users Load test where users were searching items and I was able to achieve the throughput target, even though the users' login session was 3, but problems occurred after 20 min of test when a session of Test user ids expire and Thread Group starting giving error.
My requirement is to run a load test for 1 hr with 20 user load on Thread Group, is it possible to recall setup Thread group so that I can achieve my requirement or if you have any other approach please suggest.
Theoretically it's possible to use Inter-Thread Communication Plugin to conditionally call something in another Thread Group, but I don't think setUp Thread Group is a good candidate because it's executed before the main Thread Group.
It worth switching to "normal" Thread Group and the easiest solution would be just letting it run continuously and re-login each 19 minutes so the session would be "refreshed", the delay can be introduced using Constant Timer of Flow Control Action sampler.
In the main Thread Group you can either introduce some "Startup delay" in order to let the first Thread Group to login:
or use the aforementioned Inter-Thread Communication Plugin if you need to start main threads right after logging in without any extra delay

Is it possible to simulate Once Only login but 100 concurrent users with JMeter

I'm testing a web application that only allow 5 active sessions. I want to simulate 100 concurrent REST API calls. But the below script doesn't work.
Jmeter script
Is it possible to simulate Once Only login but 100 concurrent users with JMeter?
You don't seem to be understanding what does Once Only Controller do.
It runs its child(ren) during only first iteration of the Thread Group, it doesn't execute them at the same time.
If you want to run 100 requests at the same moment - take a look at Synchronizing Timer
If in your setup 5 requests are successful and other 95 are failing you could consider logging in somewhere in setUp Thread Group and then pass the JMeter Variables holding the authentication context to the main Thread Group so all 100 threads would share the same login details.

JMeter - Answering to pings and making a parallel request indefinitely

I have a workflow to keep a user active in a site. I setup a plan for it in jmeter, but the user drops after a few minutes. The flow is:
https API1 get Login/token API1
https API2 get request for param
https API3 get request for param
Wait for Ping event (single read filter) - Here is where the
socket connection is made.
Reply with a Pong (filter frame)
Every couple of minutes do https patch API4 using parameter from API1
Repeat 4 - 6 indefinitely
The problem is that API4 call is never made. The script only goes up to the websocket single read and never executes API4. I have tried the bzm parallel control, but it never executes API4 either. I considered having two different thread groups but API4 needs the token generated from API1. I have tried several other things but for the sake of simplifying my problem, I am only posting this plan. I also looked at other questions posted here and don't quite address my use case. Any suggestions are very much appreciated
Here is the plan I am using:
using parallel controller with websocket connection initiated inside the loop
creating websocket connect before entering loop
Parallel Controller is not an answer as it will wait for api4 prior to starting a new iteration, the only solution is to call api4 in the separate Thread Group.
The token from api1 can be passed via __setProperty() function or Inter-Thread Communication Plugin

Sending concurrent http requests per sec through Jmeter

preparing test plan to send multiple http request. However, jmeter waits to send another batch of request till it gets response from first batch.
I want to send 10 concurrent requests per sec. If i run 1 mins, i should have 600 requests in the then. However, since jmeter waits to send another 10 concurrent requests till it gets response from previous 10 requests, I can't send 10 concurrent requests.
any pointer would be appreciated.
The easiest option is to go for Concurrency Thread Group which tries to maintain the defined concurrency level by kicking off new threads if current amount is not enough to conduct the required throughput. So basically you need to install Concurrency Thread Group via JMeter Plugins Manager and migrate your Sampler(s) there.
More information: Advanced Load Testing Scenarios with JMeter Part 4 - Stepping Thread Group and Concurrency Thread Group

How to run multiple request sequentially in Apache Jmeter

I have an Application where i have to do load test.Its like i have request A and B,and i have to test with 10 users and request should go like first request - A,B ,second request - A,B with ramp up period 0.
Could Any one help on this.I tried doing with Simple controller but the request are sent randomly and fring error
Check the box for "Run Thread Groups Consecutively" in your test plan. It will send your request A and B for first users then for second users and so on.
See this:
If you really need to wait until 1st user is done before starting 2nd one the fastest and the easiest solution would be setting Number of Threads to 1 and loop requests A and B 10 times in your Thread Group configuration.
If for any reason you need to have 10 concurrent users but executing requests sequentially you can go for Inter-Thread Communication JMeter Plugin which allows synchronizing JMeter threads (even residing in different Thread Groups)
The recommended way of installing JMeter Plugins and keeping them up-to-date is using JMeter Plugins Manager

Resources