When using Jmeter I have come across two easy ways to record Jmeter scripts. I will explain these methods and the some tips to make your reording more usefull.
1. Using blazemeter plugin.
This is a browser plugin that can be used to record Jmeter Scripts. Note that you should have a account created in blazemeter website for this and account creation is free. You can get the plugin for chrome from here.
After Installing the plugin, setup the plugin as shown below and start recording perform the action you want to record in the browser and stop the recording. After stooping the recording you can download a .jmx file and open it with Jmeter.
2. Using Recording Controller
This is Jmeter inbuild option that is available for recording. To record with Recording Controller follow the below instructions.
1. Create a Proxy server in the browser. To do this open Browser options and do the following configurations. Note that I'm adding localhost as my proxy host so I should access my website which needs to be recorded through the same domain "localhost".
2. Now right click on the WorkBench and add a "HTTP(S) Test Script Recorder" which can be found under non test elements and set the following configs. Make sure that the proxy port matches the proxy port that was set in step 01.
3. [OPTIONAL] Now add URL exclude patterns as shown below. This is to avoid Jmeter from recording unnecessary HTTP calls. (e.g: Loading javascripts/ Server Pings etc.)
4. [OPTIONAL] Now add a User Defined Variables Element and add any variable you might want to parameterize. What ever variable added here, if the value defined for the variable matches with any content of the recording, Jmeter will automatically parameterize this. This is quite handy when dealing with complex recordings. Make sure this resides in the same Thread group where the Recording Controller is located.
5. Now add a Recording Controller with the project. You can observe this in the above screenshot.
6. Now Start the proxy server and acess the browser and navigate to the website you want to record. Now expand the recording controller and observer the magic happening.
So that's it hope this might help someone, and please drop a comment if you have any other queries.
1. Using blazemeter plugin.
This is a browser plugin that can be used to record Jmeter Scripts. Note that you should have a account created in blazemeter website for this and account creation is free. You can get the plugin for chrome from here.
After Installing the plugin, setup the plugin as shown below and start recording perform the action you want to record in the browser and stop the recording. After stooping the recording you can download a .jmx file and open it with Jmeter.
2. Using Recording Controller
This is Jmeter inbuild option that is available for recording. To record with Recording Controller follow the below instructions.
1. Create a Proxy server in the browser. To do this open Browser options and do the following configurations. Note that I'm adding localhost as my proxy host so I should access my website which needs to be recorded through the same domain "localhost".
2. Now right click on the WorkBench and add a "HTTP(S) Test Script Recorder" which can be found under non test elements and set the following configs. Make sure that the proxy port matches the proxy port that was set in step 01.
3. [OPTIONAL] Now add URL exclude patterns as shown below. This is to avoid Jmeter from recording unnecessary HTTP calls. (e.g: Loading javascripts/ Server Pings etc.)
4. [OPTIONAL] Now add a User Defined Variables Element and add any variable you might want to parameterize. What ever variable added here, if the value defined for the variable matches with any content of the recording, Jmeter will automatically parameterize this. This is quite handy when dealing with complex recordings. Make sure this resides in the same Thread group where the Recording Controller is located.
5. Now add a Recording Controller with the project. You can observe this in the above screenshot.
6. Now Start the proxy server and acess the browser and navigate to the website you want to record. Now expand the recording controller and observer the magic happening.
So that's it hope this might help someone, and please drop a comment if you have any other queries.