JMeter: How to run two thread parallel after completion of first thread - jmeter

My application is live application & three is a heavy use of AAJX call and Java scripts.
Successful login required three steps
Login validation
On login page browser post user login information and backed first validate it and set cookies & session id for further use.
After successfully validation of user information browser initiate two request parallel towards back-end.
Browser post a request to server & server send some XML data in every 10 seconds towards browser. Back-end push information in every 10 seconds up to user logged in.
Also browser post a ping request to server to make sure user is available and active.
To test the performance of UI by JMeter I am planning to create following test plan.
Test Plan
Main Login Thread
Ping Thread
Application Thread
Now I want to run thread 2 & 3 parallel after completion of first thread.
Please let me know if this is possible in JMeter if Yes how I can run two threads parallel after completion of first.

It isn't something which is provided in JMeter out-of-the-box as currently there is no way to jump over the number of threads which are defined on Thread Group level so you'll need to do some coding in order to work it around, i.e.:
Use JSR223 Sampler (or PostProcessor)
Develop custom sampler i.e. basing on ExampleSampler which spawns more threads in order to simulate AJAX parallel calls
See How to Load Test AJAX/XHR Enabled Sites With JMeter article for more details and some reference implementation examples.

Related

Can we club parallel request in JMeter during recording

I am testing an application which invokes groups of parallel http requests during multiple-page navigation.
To mimic real user behaviour I want to club the requests hitting the server parallel.
I know I can use the "Parallel controller" but for that, I need to see the developer tool and club them.
My question is "Can we club parallel requests in JMeter during recording" as in other load testing tools we have functions to club the parallel calls which attach to the script during the recording itself.
" The reason for this question is --> I am getting question from the developer that we can't accept the JMeter result as it does not mimic the real user behaviour(Brower behaviour)" Give me your thought on this also.
JMeter neither can record nor replay parallel requests.
The build-in functionality allows simulating downloading of embedded resources (images,scripts, styles, fonts, sounds, etc.) in parallel, however these resources should not be recorded. Parallel downloading can be enabled under "Advanced" tab of the HTTP Request sampler and/or HTTP Request Defaults.
If the real user sends network requests which are not related to the embedded resources, i.e. AJAX requests - JMeter will record them but will replay them sequentially, to mimic real browser's behaviour you will need to put them under the Parallel Controller

Jmeter multiple same Requests

I could somehow run JMeter test for a user but running HTTP requests a few time such like (multiple users). The problem is that authentication only supports one session and I don't think it's ok to create 50 users in LDAP to be able to test. I tried to use 'Parallel Controller' but after executing the first request the others have the status 'Socket closed'.
I don't think it's ok to create 50 users in LDAP to be able to test
I think this is what you should be really doing.
Parallel Controller is a kind of workaround to bypass JMeter Threads Model limitation when it comes to implementing specific test scenarios like simulating AJAX requests because it assumes several requests executing in parallel triggered by a single thread (virtual user)
In the majority of cases user does sequential actions like open login page -> login -> navigate somewhere -> type something -> etc.
Ideally each JMeter thread (virtual user) must represent a real user with unique credentials so I would strongly recommend either creating as many users as you need to simulate in LDAP, if you're not allowed to have test users in LDAP on permanent basis you can even create them from JMeter like:
setUp Thread Group - create users
normal Thread Group with your main test actions
tearDown Thread Group - delete users
See How to Load Test LDAP with Apache JMeter article to learn more about different types of LDAP requests you can send from JMeter

There are many HTTP request in my jmx file ,I want to hit one HTTP request just one time irrespective of no of threads set for all

My case is-
I have to login in a website and then have to fecth a data.
For that I have created one thread group and created two HTTP request , one for login and one to fetch data.
But I want login HTTP request to HIt one time and data fetching to hit for many Virtual users.
But There is one common thread group for both.
Please help How I can sort out this?
If you need to run all requests after login in parallel, you may use Parallel Controller plugin:
Install JMeter Plugin Manager: Download plugins-manager.jar and put it into lib/ext directory, then restart JMeter.
Open menu Options -> Plugins Manager
Install Parallel Controller & Sampler plugin.
Add the Parallel Controller to the Test Plan: Right click on Thread Group -> Add -> Logic Controller -> bzm - Parallel Controller
Add your request samplers inside Parallel Controller.
Choose your Thread Group and set the number of threads (users) and loop count.
Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.
So, if you want to run login sampler just once, set:
Number of Threads (users) to 1
Loop Count to 1
There are also different types of Thread Groups. Check official documentation for more information
JMeter threads (virtual users) are totally independent from each other, they use Thread Local Storage pattern for storing session information and variables therefore if you login with one user - it will be able to fetch the data, the second user will not be able to fetch the data if he isn't logged in.
If you're absolutely sure that you want to share the same login session across multiple virtual users and perform login only once consider the following test setup:
setUp Thread Group with 1 virtual user and 1 loop to perform login
Inter-Thread Communication Plugin to store the session information (i.e. Cookies) and pass it to the normal Thread Group
Normal Thread Group with as many users as you need using the data from the setUp Thread Group
Check out SynchronizationPluginsExample.jmx test plan for reference implementation.

Jmeter workflow for Login with access token with multiple threads

I have a django application to be tested using Jmeter. Here is the Workflow
Admin user logs in , gets back access_token
Creates a user, using access_token ,unique mobile and email
Created User resets its password using OTP and a new password
Created user logs into the application.
I am using Reg Ex. extractor for accessing access_token and OTP
I am able to perform this with 5 threads, but as I increase the threads, it fails. Let me know what am I missing. Below is the screen shot Of My Jmeter.
It is not clear what exactly fails. Whole JMeter test? Some specific sampler? Your application? How many users do you add, is it 6 or 600? You need to be more specific and include at least essential failure details.
In the meantime I would suggest the following troubleshooting options:
Add HTTP Cookie Manager to your Test Plan. Given you use > 1 user you need to maintain a separate session for each login.
You need to use a separate admin account for each thread. If you have only one admin account - create users in loop using Loop Controller as your test needs to be realistic.
Run your test in command-line non-GUI mode
Disable all the listeners during test run as they consume a lot of resources (especially View Results Tree one) therefore your test may simply fail due to lack of RAM, see Greedy Listeners - Memory Leeches of Performance Testing for detailed explanation.

Multiple Instances of Firefox need to be invoked through web driver sampler of Jmeter

I have created a Thread Group which has Firefox Driver Config , a Web driver Sampler and a View Results Tree Listener.
I have also added CSV Data set Config and passing username and Passwords through it to the application.
I have around 10 Credentials.
The scenario i want to do is, I want all the 10 users to login at the same time i.e 10 instances of the firefox browser to be invoked and do the job. i have given 10 in the thread group, but the users login 1 after the other.
Basically i am doing a performance testing, So i need all the 10 users to login at the same time(Simultaneously). So that 10 instances of firefox can be invoked at the same time.
Can anyone tell me, how can i achieve this in Jmeter?
Just add Synchronizing Timer to your test plan, if you need to test simultaneous login - put the timer as a child of login webdriver sampler.
I assume that you aware of recommendations from WebDriver Sampler Tutorial like
It is NOT the intention of this project to replace the HTTP Samplers included in JMeter. Rather it is meant to compliment them by measuring the end user load time.
and
JMeter allows the creation of multiple threads, and each thread is responsible for creating load on the server. However, for the Web Driver use case, the reader should be prudent in the number of threads they will create as each thread will have a single browser instance associated with it. Each browser consumes a significant amount of resources, and a limit should be placed on how many browsers the reader should create.
So it is recommended to create main load using JMeter's HTTP Request samplers and using one thread executing WebDriver Sampler to measure real-life user experience. If you still intend to create the main load with the WebDriver Sampler remember that browsers are resource-intensive so you'll need to provide something like 1 core and 1 Gb of RAM to each browser instance so make sure that machine(s) running JMeter have some capacity.

Resources