How to configure Concurrent testing in Jmeter ? - jmeter

I need to perform the task to include the following scenerio :
2 different admin edit the same customer profile concurrently
What shall i be doing to configure this concurrent testing .
I have made Login thread Group where i used CSV config element to have different login at same time . But i have kept header manager which extract the authentication token from the last login only and edit customer profile is done through the last logged in admin . How can i make 2 different users to edit the customer profile at the same time i.e concurrently ?

As per JMeter Documentation
Variables are local to a thread
So if you have 2 threads (virtual users) each of them will have its own authentication token (given you really have 2 admin accounts and use different credentials)
Also be aware that the only way to ensure concurrency in order to have requests occur at exactly the same moment is using Synchronizing Timer. If you don't use the timer - JMeter will be trying to send requests by each thread as fast as it can, it may lead to concurrent requests but you don't have any guarantee, especially when it comes to 2 users only.

Related

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

Jmeter multi-user execution

I have a JMeter execution scenario. Here it goes:
Login with 1 credential.
Perform an operation.
Logout.
Now, issues:
I need to login using 1 credential and play the operation part with multiple concurrent users, even though I have just 1 login credential. How do I execute such a scenario ?
Please explain the whole procedure in detail as following an instructional overview sometimes leads to blockage in moving further.
Thanks!
Go through the following guide to setup the rest of the test
https://www.blazemeter.com/blog/getting-started-jmeter-basic-tutorial/
You need to use once only controller for login action. Ideally you want to use different users to avoid race conditions caused by using the same user.
If your system allows multiple logins with the same credentials it should not be a problem, just add as many users as you need in the Thread Group and each of the virtual users will execute these 3 requests upside down.
You can add __threadNum() function as the request label prefix or postfix in order to be able to distinguish virtual users and ${__jm__Thread Group__idx} pre-defined variable to track Thread Group loops/iterations.

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.

How to create multiple threads in JMeter

I recently started learning jmeter. Please help me
How can i create a multiple thread groups which performs same actions but with different credentials.
Issue is - in the current application i am testing ,if 5 users hit the refresh btn at the same time its crashing the system.
so my Requirement is - Login with 2 different users and hit refresh button
I created 2 thread groups -for user A and user B but when i run the test plan its executing simultaneously.its checking multiple threads with same credentials of user A ,Which is not my requirement. What is the way to deal with it?
I would suggest the following:
Use single Thread Group, you don't need separate Thread Groups as they are designed to represent different groups of virtual users.
Make sure you use different credentials for users A and B. Normally people use CSV Data Set Config for keeping users credentials so JMeter threads (virtual users) could read CSV file and pick up login and password combinations from there
To ensure that users A and B (or whatever will be the number) "refresh" the page at exactly the same moment - use Synchronizing Timer

Resources