How To Use JMeter To Record Test Scenarios ?
Record and Playback in JMeter-
- This is the very easy way to record the created test plan.
Step 1: Need below software
- Apache JMeter – Download and run the .bat/.sh file from the bin folder.(.bat for window & .sh for Linux)
- Java 6 or later – Download and proper installation of Java.
- Mozilla Firefox – Download and proper installation of Mozilla.
Step 3: Now build a test plan
- Add the Thread Group to Test Plan
– Right-click on Test Plan
– Mouse over Add >
– Mouse over Threads (Users) >
– Click on Thread Group
- After adding the thread group it shows like as-
Number of Threads– Total number of users which we want to hit on the server.
For example: – here we will hit the 10 users at a time on the server.
Ramp-Up Period– Time given the next user to hit on the server.
For example: – Suppose we have 10 users (Number of Thread) and Ramp up period is 10.
Then we are giving each user 1 second to hit the server.
Loop Count– We want to execute the same operation two times continuously then we need to increase the loop count as 2. It means 10 people will hit the server two times.
Step 4: Add HTTP Request Defaults
Right Click on WorkBench –> Add–> Config Elements –> HTTP Request Defaults
We are added the HTTP Request Defaults causes we will send the multiple request to the same web server.
- After adding the page it looks as below-
- Server Name or IP
- Port Number
Server Name or IP: Enter the url or IP address of the site on which you want to perform the load testing.
Port Number: Enter the default port number 8080.
Protocol: we are sending the http request so enter the Http.
Step 5: Add HTTP Proxy Server
Right Click on Workbench–> Add–> Non-Test Elements –> HTTP Proxy Server.
- It records the all action which we navigate into the browser.
After adding it shows like as below- in the red portion shows the important points of this screen.
Port: Fill the 9090 sometimes 8080 port is busy.
Target Controller: Add the place where you want to record the script. Here we choose the thread group.
URL Pattern to Include/Exclude: When the page is loaded then images are loaded, some are restricted so allow the all.“URL Patterns to Include”. This will create a blank entry.
Step 6: Add the Listener
Right click on Thread Group–> Add –> Listener –> View Results Tree.
Right click on WorkBench–> Add –> Listener –> View Results in Table.
Step 7: Setting of the browser proxy
- Open Firefox Browser.
- Click on Tools shown at the top menu.
- Click on Options shown under Tools
- Click on Network tab shown on the window after clicking Options.
- Click on Settings Button.
8.Click ok button.
Step 8: Now Record the Script
- Enter the url in the browser, it gives the screen as given below-
- Now go the Http proxy server and click on the start button as showing in the bottom-
- Now enter the url in the browser and navigate the site as you want to record and test the load.
- After complete the navigation go to the JMeter and click on the stop button from the http proxy server.
- Now you can see the all navigation which you have done on the browser.
- Add the Listener as you want-
- Now click on the save button to save the recording.
- Now run the script.
- During the running process it looks like as-
- Wait until the running isn’t completed, when it is completed then green color is changed.
Step 9: Now view of the Result-
- View Result Tree
- View Result in Table
- Summary Report
- Aggregate Graph
- Aggregate Report
- Graph Result
Please share your feedback….