Load Testing with JMeter - will it log into my site at load? - session

I wish to use JMeter to login to my site, run some reports and log out again as a load test.
Is JMeter the best tool for this? I'm concerned it doesn't maintain the browser session between requests.

You can do this very easily in JMeter. You need to create a HTTP Request Sampler (action type needs to be post), then add all the form fields as parameters (username, password etc) and have the path set to the form target. You'll also need to ensure that you have a HTTP cookie manager set to stay logged in. It's even possible to log in as different users, I wrote a blog on it here for full details on how to load test with multiple user logins in JMeter.

Yes you can use jmeter for this. It supports maintaining session across requests and the scenario you want to test is pretty common one.

Related

Unable to login using jmeter?

I have recorded login script using jmeter and when I run it the user is not logged in. There is no session parameter to pass.
Below is application which used for my study.
www.gandermountain.com
Looking into the network dump
I believe all you need to do in order to mimic the login is just to add HTTP Cookie Manager to your Test Plan
What error you are getting while running your script? If you are not able to logon, add the cookie manager (Test Plan -> Add -> Config Element -> HTTP Cookie Manager) under your test plan.
If it doesnt work, check any other parameter values getting changed in your home page and login requests. If yes, parameterize that too and then try. It will work

How to maintain session in Jmeter for testing web application?

How to maintain session in Jmeter so that each user should login, search tickets and then logout ? and this process kept going until loop completes for all users.
As I am trying to test our web application with multiple users.
Each JMeter Thread (representing a virtual user) executes samplers upside down so if you have 3 samplers for login, search and logout each thread will execute them in that order.
Keep in mind that:
You need to provide different credentials to each thread so they could impersonate different users. The most common way of parametrization is using CSV Data Set Config
It's better to add HTTP Cookie Manager to represent browser cookies.
It may also be required to perform correlation: in majority of cases application expects dynamic parameters which need to be extracted from previous page response and added to the next request. If you fail to do it you may not even be logged in. The most commonly used test element for correlation is Regular Expression Extractor however depending on the nature of the response it may worth be using CSS/JQuery Extractor, XPath Extractor or JSON Path Extractor
Add Cookie manager. Afterwards it depends on the application you will need dynamic values like viewState or eventValidation or similar ones. But first add the manager and get to the next problem :)

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 session data and runtime parameter pass for multi user

I have scenario to test different concurrent multiuser with different login and password from CSV ,
and passing session info & values and run time generated values pass as parameter to next screens for multiple pages.
How can I build Test plan & configure JMeter.
The below mentioned steps will help you achieve the above scenario:
Record the scenario
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
Do correlation for dynamic parameters
http://apache-jmeter.blogspot.com/2011/12/correlation-regular-expression.html
Use CSV for login credentials
http://ivetetecedor.com/how-to-use-a-csv-file-with-jmeter/
hope this will help
Go through the following link (my answer), How to send parameters from one http request to other in jmeter
make sure to add http cookie manager & http session manager in your test plan for run time generated values.

How to login to an email Address using jmeter?

I am testing some api for our product using jmeter. To test the api to verify the user's email address I need to login to the mail account. I have the email and password of a test user. How can I login using an api or any other way in jmeter?
Is it possible at all?
Yes that is possible. You'll have to create a test plan with multiple steps but these depend on the concrete implementation of the login.
First you must identify the following two locations:
The GET request that gets the initial login form (if this is required).
The POST request that posts the login credentials.
If your service has a stateless login form you can even skip the first step.
Otherwise the response of the GET request will contain stuff which needs to be extracted (e.g. the JSESSIONID if you are using JSF) and sent as a parameters in the POST request. You can use the Regular Expression Extractor of JMeter to extract these values and provide them as variables for use in the subsequent requests.
Here is an example screenshot of a HTTP Request element configured to POST login data to the url /common/j_security_check
You might also need to intercept an authentication token from the server response and then pass that into following requests.
Here is a blog entry with a couple of video tutorials on logins with JMeter:
http://community.blazemeter.com/knowledgebase/articles/80479-how-to-use-jmeter-for-login-authentication
You can use jmeter to login,
two ways:
parameterization using csv file(for more users)/user defined variables(UDV)
Login config elements(for single user)
Now that I understand you want to automatically click on a confirmation link from an email using JMeter, here is a blog entry that explains exactly how to do that:
http://blazemeter.com/blog/how-create-jmeter-script-check-email-during-registration-and-grab-confirmation-url
Ophir

Resources