How to record steps for load test in JMeter?
In this article we are going to see the process of recording steps in JMeter for Load Testing.
Planning for the test : In the beginning, we have to decide what to test. What should be in the test. After that , we write the steps in doc. For EX- I am writing my steps to test goole search load test. So my steps will be
a. Open Browser and write URL www.google.com
b. Accept certificate if they are asking for that.(In case of https)
c. Write a text in the search text box(I wrote "Example of jmeter recoding)
d. Click Search
After writing the steps, We have to make plan to record in jmeter. Jmeter record steps by capturing data through proxy. So, we have to set a proxy from browser and use a proxy server from jmeter to record that.
So, Lets start Jmeter Part
1. Download and Install JMeter
2. Run JMeter, It will be opened with a Test plan
3. Add a HTTP Cookie Manager under Test plan[For global cookie]
4. Add a Thread group under Test plan(I have used 3 user for 2 second and 3 cycle to run)
5. Add a Test Fragment under Test plan(Test fragment is the helper for test case making, we will record with this)
6. Add Recording Controller under Thread group
7. Add a HTTP Proxy Server under Test Fragment
Note : For Jmeter 2.28we will not get by add element under test fragment. We have to add a HTTP proxy server under workbench and then move(cut/past) that under test fragment.
8. Add a Listener(View Results Tree) under HTTP Proxy Server[Optional]
9. Now, See HTTP Proxy Server, I use port 8080 and http client 3.1 for proxy
10. Now, open a browser( I use Firefox) and set proxy as localhost with port 8080.
Note: Use all protocols to use the same proxy
For Firefox :
Tools-> Options -> Advance ->Network ->Connection -> Settings
a. Select, Manual Proxy Configuration
b. Set HTTP Proxy as localhost , port 8080
c. Select Use the proxy server for all protocols
Press ok and come fo main window.
11. From JMeter, HTTP Proxy server, Start the server
11. From browser , Execute the steps that we have planned to do.
- Hit URL www.google.com
- Enter text for search
- Click search button
12. Stop HTTP Proxy server in jmeter
13. Now, Expand Recording Controller and we can see the recorded steps.
Note:
-If we see View Results Tree under HTTP proxy server, we will also see the steps executed and their results
-For HTTPS web application, the security certificate should be trusted, and added to the browser..
14. Now, Add necessary listener under Thread Group(I have added View Results Tree/View Results in Table)
15. Run the test from Run Menu
We have successfully completed recording steps and running that for load testing.
Some time while recording , there may be unnecessary requests gone inside proxy. We need to see and refactor(if needed) the recorded steps.
Tips :
1. You may directly config proxy server to record under Recording Controller .
2. For ajax & JS based page, Add HTTP Cache Manager,HTTP Cookie Manager under the Recording Controller.[It works perforect for ajax requests)
Thanks...:)
Planning for the test : In the beginning, we have to decide what to test. What should be in the test. After that , we write the steps in doc. For EX- I am writing my steps to test goole search load test. So my steps will be
a. Open Browser and write URL www.google.com
b. Accept certificate if they are asking for that.(In case of https)
c. Write a text in the search text box(I wrote "Example of jmeter recoding)
d. Click Search
After writing the steps, We have to make plan to record in jmeter. Jmeter record steps by capturing data through proxy. So, we have to set a proxy from browser and use a proxy server from jmeter to record that.
So, Lets start Jmeter Part
1. Download and Install JMeter
2. Run JMeter, It will be opened with a Test plan
3. Add a HTTP Cookie Manager under Test plan[For global cookie]
4. Add a Thread group under Test plan(I have used 3 user for 2 second and 3 cycle to run)
5. Add a Test Fragment under Test plan(Test fragment is the helper for test case making, we will record with this)
6. Add Recording Controller under Thread group
7. Add a HTTP Proxy Server under Test Fragment
Note : For Jmeter 2.28we will not get by add element under test fragment. We have to add a HTTP proxy server under workbench and then move(cut/past) that under test fragment.
8. Add a Listener(View Results Tree) under HTTP Proxy Server[Optional]
9. Now, See HTTP Proxy Server, I use port 8080 and http client 3.1 for proxy
10. Now, open a browser( I use Firefox) and set proxy as localhost with port 8080.
Note: Use all protocols to use the same proxy
For Firefox :
Tools-> Options -> Advance ->Network ->Connection -> Settings
a. Select, Manual Proxy Configuration
b. Set HTTP Proxy as localhost , port 8080
c. Select Use the proxy server for all protocols
Press ok and come fo main window.
11. From JMeter, HTTP Proxy server, Start the server
11. From browser , Execute the steps that we have planned to do.
- Hit URL www.google.com
- Enter text for search
- Click search button
12. Stop HTTP Proxy server in jmeter
13. Now, Expand Recording Controller and we can see the recorded steps.
Note:
-If we see View Results Tree under HTTP proxy server, we will also see the steps executed and their results
-For HTTPS web application, the security certificate should be trusted, and added to the browser..
14. Now, Add necessary listener under Thread Group(I have added View Results Tree/View Results in Table)
15. Run the test from Run Menu
We have successfully completed recording steps and running that for load testing.
Some time while recording , there may be unnecessary requests gone inside proxy. We need to see and refactor(if needed) the recorded steps.
Tips :
1. You may directly config proxy server to record under Recording Controller .
2. For ajax & JS based page, Add HTTP Cache Manager,HTTP Cookie Manager under the Recording Controller.[It works perforect for ajax requests)
Thanks...:)