In this tutorial ,we will study recording of HTTP or HTTPS requests in JMeter using HTTP(S) Test Script Recorder (or HTTP Proxy Server in older versions of JMeter). Let's begin with the very first step i.e. launching JMeter. Once, we launch JMeter, we can see the the two controls in the left pane -
Now let's see how we can record scripts in JMeter-
So, now we have got a skeleton where we can record and create scripts, next thing we will do is to record HTTP or HTTPS requests inside the transaction controllers. For this, we need to setup proxy in our browser. Although we can record calls with any browser but it is recommended to use Mozilla Firefox just because of its plug-in 'Firebug' as firebug is very important for validating whether all calls are successfully recorded or not.
Steps to set proxy in Mozilla are-
Let's see what we have done, the IP address we have entered in HTTP Proxy textbox is loopback address that is software loopback interface of the machine itself on which we are working and the port we have specified is the Port through which all the traffic will be routed, this port will be used in JMeter also.
Now we will configure JMeter for recording HTTP requests in the transaction controllers -
Now whatever we do in our browser will get saved in the form of http requests in the transaction controller that we have chosen. Suppose, we chose "User launch application" as our target controller then we will click on start button on JMeter then we will go to our browser and launch the application. Again we will go to JMeter and check whether any requests are recorded in the "User launch application" transaction controller or not. If yes then we will click on stop button, chose next transaction controller from the target controller dropdown (User enter valid credentials and click on Login button), click on start button, go to browser and enter credentials and click on login button. Go to JMeter and click on stop button. Perform these steps for every transaction controller.
This completes the recording part, next thing is to add Listeners to our Test Plan for interpretation of test results. For this right click on Test Plan-> Add-> Listeners. You will get a list of all the Listeners available, as of now use Aggregate graph and View Result Tree Listeners.
Now we can run the script by pressing Ctrl+R keys or click on Play icon. On top right you will see an icon indicating that the test is running. Once complete, check the results and graphs in the Listeners. Some of the transaction controllers may fail (check in view result tree- failed requests come in red) because lots of scripting is still required in the test plan.
So, this was all about record and playback in JMeter. In the next posts, we will study "Parameterization and Correlation" that are heart and soul of scripting.