login with two different users for different use in jmeter? - jmeter

How can generate following scenario,
user1 logged in & take some action on form.
user2 logged in & approve the taken action.
please suggest best way to automate the scenario via jmeter.

Depending on what you are trying to achieve:
Easy way: single Thread Group. Just add one HTTP Request sampler per each action, i.e.:
HTTP Request 1 - login 1st user
HTTP Request 2 - perform an action
HTTP Request 3 - logout 1st user
HTTP Request 4 - login 2nd user
HTTP Request 5 - approve the action
etc.
If you have 2 Thread Groups, i.e. first one is creating the actions and the other one is approving them the best option to ensure that the the "approvers" have something to approve will be using Inter-Thread Communication plugin, this way you will be able to "pause" the approvers until approval forms get created. You can install Inter-Thread Communication plugin (as well as the other plugins) using JMeter Plugins Manager

Related

Redirect Jmeter to the home page after successful login with multiple users

I created a script multiple user logins and redirected to the home page. For multiple user logins fetching data from CSV file but after logged in, home page redirection is not working.
There are multiple possible explanations:
Your login fails somewhere somehow so you're still at the login page, check the server response using View Results Tree listener and if this is the case - fix your script. It might be sufficient to add a HTTP Cookie Manager to represent user session
You might need to play with Redirect automatically / Follow redirects checkboxes on HTTP Request sampler level
Your redirect is being managed by JavaScript and JMeter is not capable of executing JavaScript so you need to extract the desired redirect location using a suitable JMeter Post-Processor (basically implement correlation of the redirect URL) and add another HTTP Request sampler to open the redirect target.
More information: Redirections in HTTP
In general make sure that JMeter sends the same requests as the real browser does, given this simple rule is met you should be able to properly simulate real user actions

Recorded user authentication then run same script with another user id and password but Jmeter displaying previous user's dashboard

Recorded user authentication for one user then run script in Jmeter and successfully logged-in. Now change user id and password for another user but displaying previous user information not changed user information
Check out if there are any headers being sent via HTTP Header Manager. It might be the case your application under test identifies user via header
Check if recorded URLs contain dynamic postfix which can act as user session identifier
If there is a HTTP Authorization Manager in your Test Plan - update username and password there
Consider adding HTTP Cookie Manager to our Test Plan - it should be sufficient to automatically handle user sessions
Generic troubleshooting step: capture the requests sent by JMeter and the real browser using a sniffer tool like Wireshark or Fiddler and compare them. Amend JMeter configuration to eliminate differences.

multiply login request in JMeter

I use JMeter to load data using web services. I need to login from JMeter once, then I need to read ids from CSV file and call HTTP request for each id.
My current configuration is as in the attached picture.
The problem is that in this case login is called for each HTTP Request. I want to change it, so it will be called only once at the beginning. What is the best way to do it in JMeter?
Right click on login -> Insert Parent -> Logic Controller -> Once Only Controller:
The Once Only Logic Controller tells JMeter to process the controller(s) inside it only once per Thread, and pass over any requests under it during further iterations through the test plan.
..
For testing that requires a login, consider placing the login request in this controller since each thread only needs to login once to establish a session.

How to Configure Jmeter for after Login process in an Application?

How to Configure Jmeter for after Login process in an Application?
I am able to configure the login request for 100 users from the CSV file with the help of Jmeter's "CSV Data set Config", but after the successful login of all I want to know how to configure the jmeter to go to the "Offers" page of there(100 user) accounts.Means 1 User can login & View his/her "Offer" page.Please Help.
There are two ways to achieve this scenario:
add another HTTP sampler & fill the details like Server IP, Path of Offers URL (you will have already done the same for Login), HTTP Header data etc. and pass correlation parameters from the response of Login if required to view the offers specific to 1 user.
make sure you use right method (GET/POST) in HTTP Sampler.
record the whole scenario (ref: http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf).
You will still have to do the correlation of parameters (using regular expression extractor or Xpath extractor) wherever required. This entirely depends on the parameters required for the offer page HTTP request.
hope this will help.
You'll need a cookie manager to store the session and cookie for all logged in users.
http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cookie_Manager

Jmeter-simulate 150 logged in users on the website and make request to other page with logged in status

I have a scenario where I have to simulate 150 logged in users on the system and they will be making request to a different page at the rate of 8 requests per second with login status.
How do I do this
Assumption 1: Thinking of having two http samplers one for login functionality and other one for requesting the page I wanted (Select product page). But my doubt is, is this the right way to simulate the logged in user on the other page(select product page)? as login and select-product page requests are in different HTTP samplers, their access rights will be treated differently I guess and I will be ending up as an anonymous user on the
select-product page instead of logged in user. Please suggest a solution.
I don't want to login each time I make a request to select-product page as the login is big bottle neck which takes lot of time, rather I would like to log all users at first than use the logged in users to ping select-product page with logged in status.
If I have multiple HTTP samplers (for login, select-product), number of request to server are increasing, but at all times I want to limit number of requests to 8 only.
Please help.
thanks.
Check links and tips below for solutions:
If you put your Login and Select Product samplers under the same Thread Group - login and select product actions will be executed by the same thread.
Add HTTP Cookie Manager to your test plan. It'll keep session information so the same (and unique for each thread) session will be used per thread.
To perform login only 1 time place the relevant sampler under Once Only Controller
To limit load to 8 requests/sec only use Constant Throughput Timer.
Hope this helps.

Resources