JMeter: run parameterized threads - jmeter

I've written simple test plan in JMeter, plan consists of one thread group and one controller with "HTTP request" elemets. Plan performes login to website, session refresh and logout.
Is there a way to preform thread running, with different params (login/password) each time?
thanks.

There are lots of different ways to parametrize your test. If you have a lot of users you want to use, I would recommend using a CSV Data Set Config. If you only have a few you want to use, you can try User Defined Variables or User Parameters. Make sure you check out the documentation, as each one is used slightly differently.

Related

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.

Need to send multiple PUT request through JMeter

Expecting to send multiple PUT requests through JMeter to test PUT API with below mentioned constraints:
Multiple logged in users.
Multiple users with different data to be updated.
Looking forward to get the help in this regards.
You need to create scripts in Jmeter if you want to send multiple PUT requests. You have to create PUT request in Jmeter using HTTP sampler.
Multiple logged in users.
If the APIs that you are testing uses some authentication mechanism (which i reckon it should), then you have to add other HTTP requests(Authentication requests) as part of Jmeter test. Otherwise, you can increase the number of users in the thread group and do testing.
Multiple users with different data to be updated.
For this task - you have to parametrize the PUT request data. You can go through google and learn about parametrization in Jmeter.
I would suggest you to first explore Jmeter, learn some basics of performance testing and then go ahead with testing.

Blazemeter Script Runninf on Jmeter doesnt save data in DB

I am creating a script through Blazemeter (which storing some data in DB) and running through JMeter. Script is running fine but data is not stored in DB. What I am missing?
The chance of replaying recorded script is minimal as modern web applications widely use dynamic parameters for security reasons or client-side state tracking
Make sure to add HTTP Cookie Manager to your Test Plan
Make sure to perform correlation of any dynamic parameters
With regards to "Script is running fine" - JMeter automatically treats responses with HTTP Status Codes below 400 as successful, so "green" result doesn't necessarily mean that your script is doing what it is supposed to be doing. Try inspecting responses using View Results Tree listener, most probably you're getting stuck at login page. Going forward you can consider adding Response Assertions in order to perform extra checks against the responses.

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

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.

Resources