-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

JMeter Cookbook
By :

Recording scripts is where you will spend most of your time. It is often the first step to develop test plans for applications. Though you can develop test plans manually by building them from within the JMeter GUI, or generating them via some domain-specific language (DSL), recording scripts by JMeter's HTTP(S) Test Script Recorder is one of the available options you have when building your test plans.
In this recipe, we cover how to record test scripts with HTTP(S) Test Script Recorder. Perform the following steps:
JMETER_HOME
)bin
directoryFor Windows, type the following command:
jmeter.bat
For Mac OS/Unix, type the following command:
./jmeter
Templates were added in JMeter 2.10, so don't expect to see them in versions prior to that.
8888
to 7000
.8888
.With these settings, the test script recorder server will start on the port 7000
, monitor all requests going through that port, and record them to a test plan using the default recording controller. For details, see the following screenshot:
HTTP(S) Test Script Recorder configuration
These steps instruct JMeter to act as an HTTP proxy and listen for incoming and outgoing requests from your browser to the Internet on the assigned port, in our case 7000
.
We now need to configure the browser to use the proxy server we just configured and redirect requests to the assigned port. There are several ways to do that, but we will focus here on the two most common ways.
Modern browsers have a vibrant and active plugin ecosystem that allows you to extend the capabilities of your browser with an added plugin. FoxyProxy is one such plugin (http://getfoxyproxy.org/). It is a neat add-on for a browser that allows you to set up various proxy settings and toggle between them on the fly, without having to mess around with system settings on the machine. It really makes the work hassle free. Thankfully, FoxyProxy has a plugin for all major browsers including Google Chrome, Firefox, and Internet Explorer. If you are using any of those, you are lucky; head over and grab it!
The other common way to configure the browser is to change the system settings. The following are the details on how to configure Windows and Mac OS.
On Windows OS, perform the following steps to configure a proxy:
localhost
in the IP address.7000
(to match the port you set up for your JMeter proxy earlier).Manually setting a proxy on Windows 7
On Mac OS, perform the following steps to configure a proxy:
localhost
.7000
(to match the port you set up for your JMeter HTTP proxy earlier).Manually setting a proxy on Mac OS
For all other systems, consult the related operating system documentation.
With both JMeter's HTTP(S) Test Script Recorder and browser configured to use it, we are now ready to record a test. Perform the following steps:
The HTTP(S) Test Script Recorder server is set up to listen to requests on a particular port and then set the browser or system to redirect all requests to the assigned port. This allows us to capture the user actions as they interact with web applications, allowing us to replay their actions like we did in the Executing a test script recipe.
Change the font size
Change margin width
Change background colour