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

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.

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

Jmeter - Run multi-threaded users simultaneously without affecting the flow

I have a user flow (create base64 header auth > register request > Register > login > sending data) which I want to run simultaneously (100 users).
If I use the Thread Properties as it is, it will run in asynced way.
Examples:
User 3 will try to login with token of user 1, user 40 will register with registration header created for user 24 and so on..
Token for login extracted from base64 process,
another token is extracted from 'register-request' and used as variable in 'registration' header.
I want first user to register with token created in first register-request and login with token created in base64 process, and so on for next users.
Is there a way to do so?
Normally JMeter virtual users store variables in the thread-local storage so given your test plan design is good each thread (virtual user) should use its own header.
Not knowing the details of how your header is generated it's hard to say what's wrong, I would recommend using Debug Sampler and View Results Tree listener combination and double check the header value (and any interim variables) - hopefully you will be able to determine the cause. If not - you will need to share the test plan somewhere somehow.
Other things to consider:
If your application requires Auhtorization header in form of username:password encoded into Base64 you actually don't need to generate the header manually, you can use HTTP Authorization Manager which automatically generates and adds the relevant header to the requests. Check out How to Use HTTP Basic Authentication in JMeter article for more details if needed.
There is __base64Encode() function which you can use for encoding a custom string into Base64, the function can be installed as a part of Custom JMeter Functions bundle using JMeter Plugins Manager

Login page is returned always even though sessions are handled

JMeter version 5.x and 4.0
Protocol : Https
Steps
Start creating a test plan with a recording template
Configure the HTTP(S) Test Script Recorder with HTTPS domain, target controller
Save the test plan and start the proxy server
Configure Firefox with security certificate and proxy details
Access the login page https://www.systemname.com . Request is recorded
Login to the system with valid credentials. Request is recorded successfully
Add a Boundary value Extractor post processor to extract session variable (LCSRF_VAL) and replace the session value recorded in the login request with ${LCSRF_VAL}
Save the test plan and run the test
Check the responses in View Result Tree --> HTML view
Actual Outcome
User is not logged into the system. Login page is returned.
Expected Outcome
User should be able to login when sessions are handled
Note :
It worked fine if recording started from a URL of a page inside the system. For example
https://www.system.com/en/administration/Search?nav=Administration

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 login and authentication sampler

Could anyone please help to test the login / authentication with the following scenario?
User access the site "sitaA.com" home page. In that page, there is a button "login with oauth".
Upon clicking the "login with oauth" button, "siteA.com" redirects to "siteB.com" in which the user is able to key in username and passowrd and sign in. It authenticates (oauth) the user and returns back to "siteA.com".
siteA.com will send the client id and call back url when redirects to siteB.com.
How to achieve this using JMeter?
Thanks in advance
OAuth is a basically a way of getting a token. If you're load-testing OAuth-enabled application you need to do the following:
Request temporary access token
Authorize access token
Change temporary access token to something permanent
You can do steps above manually, capture permanent access token via sniffer and add it to your requests as a separate HTTP Request parameter. If you have limited number of user logins to reuse in test it may do the trick for you.
However if you need to test end-to-end flow which assumes obtaining token process via JMeter you need to consider OAuth Sampler Plugin
So basically you need to do one of the following:
Manual 3-stepped OAuth login and capture token process followed by adding token as a parameter of HTTP Requests for each virtual user
Automated OAuth login process by means of JMeter OAuth sampler
If you have limited number of logins/users option 1 may be better
P.S. There is also an option for advanced JMeter users and/or Java developers to add OAuth java client libraries to JMeter lib/ext folder and use Beanshell Samplers to authenticate with OAuth. It's also likely that you'll have to use Selenium with JMeterto navigate to OAuth callback page and confirm authorized login from there.

Resources