Record Script in JMeter

What is importance of record script in JMeter?

Let’s discuss importance of record script in JMeter in this tutorial. Now a days, Software development process is becoming very complex. You can notice that sometimes the web site showing some loading problem, Network problem etc. If you want to handle properly above error, then you need to improve the Performance Testing methods.

There are lots of tools are present to perform performance Testing. JMeter is one of them and it’s a powerful tool to proceed for performance Testing. You can design your test script based on real time scenario and run individual scenario if required.

One question you can think that how JMeter will handle the HTTP request?

JMeter uses proxy to handle the HTTP requests in the test script recorder. So, what is Proxy?

Proxy is the component which acts like intermediate between you and Remote server. You can record the interaction with browsers when JMeter starts running with proxy. Through proxy setting you can run most of the complex bowser interaction in JMeter.

Let’s understand how to record script in JMeter.

Prerequisite to record script in JMeter:

You need some application in your system before you start working with JMeter. Below is the list of those applications.

  • Apache JMeter
  • Java 
  • Mozilla

That’s all. Now let’s proceed with the recording script in JMeter.

Steps to record Script in JMeter:

Below diagram shows the simple steps to proceed with the recording script in JMeter. It has 4 steps. Let’s understand each step in details.

Record script in JMeter

Step -1: Setting Proxy Server.

Setting proxy server in JMeter is very simple and little tricky. You need to follow steps to set up proxy server.

Add Thread Group:

To add Thread group, right click on the on the Test plan and click Thread Group as shown in below screenshot.

Record script in JMeter
Record script in JMeter

2. Add HTTP Request:  

To add Thread group, right click on the on the Thread Group and click HTTP Request as shown in below screenshot.

Record script in JMeter
Record script in JMeter

From the above screenshot, you can see proxy settings field is showing in JMeter. Let’s understand the proxy setting configuration in detail.

  • Name: This field signifies the name of the assertion which will be listed under the Thread. This field is so crucial if you will be working with a big application having lots of validation and functionalities.

Name : Home Page

  • Comments: This field is usually used to give comments to our Assertion. This field is optional.

Comments: Performance Testing performed on Home page. (Optional)

  • Protocol[http]:   This allows tester to provide the protocol details whether it is http or https. If your protocol in http then you can leave this blank as this will take http default. If you want to make the request https then you need to mention https in this protocol field.

Protocol: http

  • Server name:   Server name is nothing but the base URL or IP address of the website

Server name:

  • Port Number: This is the port number of the server.

Port: 7070

  • Method: This field indicates whether the application uses Get or Post architecture. If your application is used GET, then you should choose GET option for this field.
  • Path: Path is the extension URL of the server name. In general logic this is the individual page of the website for which you want to performance testing.  

After filling all these details, you can see you script like below.

HTTP Request

Configure Firefox to work with JMeter.

After configuring the proxy setting in JMeter, you will move to proxy settings in Browser (Firefox). To Configure the same, we need to follow below steps.

Step-01: Open Firefox

Step-02: Go to Network Settings

Step-03: Choose Manual proxy Configuration

Step-04: Provide HTTP Proxy as localhost and Port 7070.

Step-05: Click on OK.

Now your browser is ready to run the Test Script with JMeter

Add Listener to record the JMeter Script.

In previous section we have understood the configuration the JMeter to run the test script. Now we need add the Test plan element “Listener” to listen the test script and display the result.

To proceed with we need to analyse which Listener is required to proceed with running the test script. Here we will add the simple Listener “View Results Tree”.

Result Tree

From the above screenshot, you can see proxy settings field is showing in JMeter. Let’s understand the proxy setting configuration in detail.

  • Name: This field signifies the name of the assertion which will be listed under the Thread. Name field is so crucial if you will be working with a big application having lots of validation and functionalities.

Name: HomePage

  • Comments : Comments field is usually used to give comments to our Assertion. This field is optional.

Comments: View Results Tree For Home Page

  • Log/Display Only: This field allow us to specify that whether you need to display only Error or Success. If you check Error, then under Sampler result, only Error responses will be displayed, If the test plan has no Error then no response will be displayed under sampler result field. Same is for Success also.

We will see the result for all every individual responses. So do not choose Error / Success

  • Text: Under Text, each sampler label will be displayed for which test plan is running,
  • Sampler Result: Sampler result will display details of response with respect to each requests.  

That’s Done. We are ready to run the script. TO run the test script click on “Run” and observe the responses.

Leave a Reply

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