Recording Web Applications in JMeter – Part 1

Recording Web Applications using JMeter

JMeter is an open source performance tool is widely used for performance testing variety of applications. This will be a series of posts on how to use JMeter as a performance testing tool. This article will explain how to create a recording of Web Application traffic which you can then captured and be used for playback using JMeter.

When JMeter is launched the default items loaded are Test Plan and Work bench. To start with recording using JMeter, A thread group has to be added to the Test Plan

  1. Navigate to Test Plan –> Right Click –> Add –> Threads (users) –> Thread Group

Add thread group to the test plan

Add Http Requests defaults to the thread group

2. Navigate to thread group –> Right Click  –> Config element –> Http Requests default

Add HTTP Requests default to thread group

3. Configure Http Requests default – Enter the URL that the script has to be generated for in the field Server Name or IP

Configure Http Request default

Add a Http Proxy server to the Work Bench

4. Navigate to Work bench –> right click –> Non Test elements –> Http Proxy server

Add HTTP proxy server to the workbench

5. Configure the Http Proxy Server with below values

Port: 8080 (default value)

Target Controller:  Test Plan > Thread Group

Grouping: Put each group in a new Transaction controller
Please refer to the screenshot

Configure HTTP proxy server

********Very Important*****

Click on Add button under the section “URL Patterns to Include” and enter “.*” (without double quotes) representing everything has to be recorded

Click on Add button under the section “URL patterns to exclude” and enter.*\.jpg, .*\.png, .*\.js, .*\.css one at a time as show in the below screenshot. The syntax has to be followed exactly otherwise the scripts may bodybuildingcom genf20 not be recorded in JMeter.

Config patterns to include and exclude

6. Now configure your favorite browser to send the requests on the port 8080. In case of Internet explorer the steps are as below:

Launch IE –> Navigate to tools –> Internet options –> Connections –> LAN Settings –> Check the field “Use a proxy server for your LAN and enter the details as Address: localhost and port 8080. Screenshot attached for reference

Configure LAN Settings in browser

Now everything is set to start recording the user actions in JMeter

Navigate to Http Proxy Server and click on Start button. JMeter starts sniffing the network traffic on the port 8080. Unlike commercial tools the browser is not launched automatically. The browser has to be launched and the user activities are to be performed.

After each user action ensure that the script is getting recorded and change the name of the transaction controller as shown in the below screenshot

Edit the transaction name after each user action

Once all the user actions navigated and they are recorded into the JMeter script, click on the stop button under the Http Proxy Server.

The script recording is done in JMeter.

This may seem like a lengthy process.   TIP::  There is a partially open source tool (because of its license terms) called Badboy where the user actions can be recorded (similar to any commercial performance testing tool) and finally the script can be exported as a JMX file, this can be directly imported into JMeter. Sounds easy? This method has to be followed if the web application uses the secured http protocol i.e. https protocol.

Happy Script Recording in JMeter.

4 thoughts on “Recording Web Applications in JMeter – Part 1

  1. Hello,

    I need to test Mobile Applications developed for Android and I-phone devices.
    I need to test it with many(50-200) simultaneous users through Parameterization.

    I searched on the web and came to know that JMeter can be used for Mobile “Web” Performance Testing.
    I want to know whether it can be used for Mobile “Application” Performance Testing also?

    Or can you please suggest any other OPEN SOURCE TOOL for Mobile “Application” Performance Testing?

    Thanks,
    Vikram

  2. Hi Rnarra,

    Thank you for posting this Recording detailed description. It will great help if you specify how to manage correlation and parametrization in JMETER?

    Thank you in advance.

    Regards,
    Rizwan Saheb

  3. I followed the above mentioned steps,I did settings related to LAN settings in IE and then I tried to run my website by using url to record. but it is displaying, webpage cannot be displayed. Please help me to solve this pblm

  4. Is it possible to test an application which is running under LAN network using JMETER? If it is possible to do so, then what settings I need to do? Please suggest..

Leave a Reply

Your email address will not be published. Required fields are marked *