Login to a Web Application With JMeter

If you are developer then it is your sole responsibility to analyze the behaviour of your web application under load testing. So we are going to create a test plan for most important step of web application “LOGIN”.
Let’s start.

  1. Create a new Test Plan and name it “Login”.
  2. Now we will create a User Defined Variable. Click on “Add”

name: site
value: example.com // your web application name
1

  1. We will use this variable in our HTTP request sampler.
  2. Now we will Add a Thread Group.Right click on Test plan name “Login”->ADD->Threads(Users)->Thread Group

2

  1. Now we will add HTTP Request Sampler for login request

Right click on Thread Group->ADD->Sampler->HTTP Request
Name it if you want.
On Basic Tab type Server Name or IP of web application on which you want to test
Here we have created the variable so we will use that ${site} and type the path.
Server name or IP: ${site}
Path: /login
3
 

  1. Now add login credentials in parameters as per your source file page

username: raju
password: 12345678
 
4
Add Listener to View Results. Here we are using “View Results tree”
Right Click on Thread Group (User)-> ADD-> Listener-> View Results tree
Run the test plan.
And Voila! We successfully logged in.
5
Here you can see that Error Count is Zero and Response Code is 200, so we are successfully logged in. Now this is your time try it out.
References:
http://jmeter.apache.org/usermanual/index.html