Jmeter workflow for Login with access token with multiple threads - jmeter

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.

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 load testing for login

I want to test how many users can concurrently login to the application. For that, can I create one user name and password and increase the thread to 100? or should I create 100 username and passwords and load it somehow?
Treat each JMeter thread (virtual user) as the real user using a real browser, it means:
Different credentials (can be provided via CSV Data Set Config)
Properly simulating browser network footprint including (but not limited to)
Sending and receiving headers (and cookies as special header sub-type)
Downloading embedded resources (images, scripts, styles, fonts, sounds)
Representing browser cache
Simulating AJAX requests
Mimicking real user "think time" as real users don't hammer application non-stop, they need some time to "think" between operations so consider adding appropriate Timers
Login itself won't tell you full story, you need to produce realistic workload, i.e. after logging in user should start doing something which he's normally doing
Usually concurrent users = different users, because it should be based on real case scenario
During a load test you try to emulate real-world conditions
If you want to have concurrent users in your application you should use different users because most servers won't allow same user to use your application with multiple sessions, also your application wants to (test) support multiple users so you need to load test the common scenario first.
If your application allows user to use your application with multiple sessions
, then add a second load test which test it also

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.

JMeter - Log All Users In And Then Execute Other Steps

I am load testing against a Registration system. I currently have a JMeter script that pulls user information from a CSV file (CSV Data Set Config) and my Thread Group has the following steps:
Contact CAS server, get login ticket
Login to CAS
Execute tasks in Registration system
Logout of CAS
JMeter runs through each of those steps as a separate thread and the script works.
The problem is that our test isn't quite accurate when compared against the behavior of our users in real life. Like I mentioned, this is a Registration system, and our end users are logging in and authenticating (via CAS) minutes before they actually begin hammering the actual system (when Registration opens at midnight - and the floodgates open).
In real life we never have problems with our CAS authentication system because we don't have thousands of users authenticating at once. When we do our load testing with JMeter the first two steps are to authenticate via CAS, and this makes CAS a bottleneck and it begins to fail when we load test with 500 users over a span of 10 seconds. As such, our load testing transactions aren't able to hit the actual Registration system and the JMeter load test isn't valid.
Is there a way to update a JMeter script to log all users in first (loop through the first two steps and maintain the CAS session info for all users), and then perform the rest of the steps?
Stirling,
Please use 'Synchronizing Timer' element of the JMeter that will wait for all the users to login and then move forward to the next step (Registration System).
You can create your script in following structure:
HTTP Request for Contact CAS server, get login ticket
HTTP Request for Login to CAS
Synchronizing Timer [Set the 'Number of Simulated Users to Group by' to 0 and Timeout based on your requirement [Recommended value to set is '300000' i.e 5 minutes]. Do not set Timeout to '0' otherwise your test will remain in running state forever if any of the users gets failed in the previous step]
HTTP Request for Execute tasks in Registration system
HTTP Request for Logout of CAS
When the test completes 'HTTP Request for Login to CAS' step then it will wait for all the users to reach at that step before moving to 'HTTP Request for Execute tasks in Registration system' step.
If you need information related to other JMeter elements then you can refer to JMeter knowledge base to get all the critical information at one place.
Kindly let me know if you have any questions.

How to login a large number of users in Jmeter?

I have a project and need to test a large number of of users in Jmeter but the problem I am facing is how to login lots of users, it will be tedious for me to enter their data manually and the token.
Can we remove or bypass the session id/token? So I won't need to input it manually. Is there any simple way to login lacks of user so I can test the load and stress testing. Or is there any other open source tool in which I test this?
I think you should read the Apache JMeter User Manual first.
You work around to be like:
Try to record only one user login session using the Apache JMeter HTTP(S) Test Script Recorder.
Use CSV Dataset Config to pass all your login credentials in JMeter.
Add a Cookie manager in your test plan.
Use regular expression extractor or JSON path processor (Depending on your request type) if you need bypass any data in your subsequent request. Check this article.
You won't be able to simulate one lack users from your machine I guess.Actually, it depends on your hardware configuration. So check for the Distributed testing.
You have run your test in Non-GUI mode. You can use GUI mode for the only debugging purpose.
Do not add any listeners when you perform your load test since they consume more memory.
Try to tweak your JDK heap size accordingly.
Try to use updated JMeter version and JDK both.
It actually depends on your application design, for instance if usernames are matching some pattern like:
user1
user2
user3
etc.
you should be able to just add __threadNum() function as a postfix
If your users are present in a database table you can use JDBC Test Elements to read usernames from the database
When it comes to logging in, it is not about single request which performs login operation, your web application test must always represent real users using real browsers as close as possible, so the login flow should look like:
Open Login Page
Extract token using one of JMeter Post Processors
Perform login providing credentials and the token from the previous step
More information:
Building a Web Test Plan
Building an Advanced Web Test Plan
How To Login Into A Web Application with JMeter

Resources