Recordring Test Scripts in JMeter

Record Testing help tester to record & run their activity against test target. It is a type of automated testing but for multiple users. This tutorial guides you on how to use Proxy Server to record your Test.

The Proxy Server allows JMeter to watch and record user activity while they are browsing web application with a normal browser.

The Test Plan consists of all actions that you need to execute your performance test script. The test plan can be taken as a practice area or temporary storage as the test plan.

The most important component in HTTP(S)TestRecorder is which can record the scripts directly, and the tester can put the load on those later on.

Introduction to JMeter

Basic Settings to do While Recording the Test Scripts :

  • Launch the JMeter in your system.
  • Once the JMeter has opened, Right-click on the Test Plan-->Add--> Non-Test Element-->HTTP(s)Test Script Recorder add-http-test-script-recorder-jmeter
  • The HTTP(s) Test Script recorder page will look like, as shown below. the-test0script-recorder-page-jmeter
  • If you want, you can change the name of the Test script recorder, or else you can keep the same name.
  • The port number inside the HTTP(s) Test Script Recorder represents the user actions. That means JMeter is listening to the port number for any further actions to record.
  • And you can consider HTTPs Domains as an optional field because the JMeter automatically captures your domain name.
  • Next, there are two tabs, such as Test Plan Creation and Requests Filtering.
  • Where the Test Plan Creation contains two fields, such as Target Controller and Grouping under Test Plan Content.
  • The Target Controller is used to store the Recorded scripts.
  • Click on the Target Controller and select Test Plan>HTTP(s) Test script Recorder. target-controller-test-plan-text-script-recorder-jmeter
  • Next, click on the Requests Filtering tab, which is used to filter the Images, adds, and buttons, and so many components that are generated on the full website.
  • But do not need all the components which are generated on the website; basically, we just need HTTP Request and Response.
  • By clicking on the Add, Suggested will exclude the Images, Adds, and unnecessary components while recording the Test script. add-suggested-excludes-jmeter
  • If it has come across any unnecessary components link, then it will just skip them.
    adding-suggestedexcludes-jmeter
  • So These are the basic settings you need to do while recording the Test Script.

Installation and Configuration of JMeter

The Settings to do while Recording JMeter using Firefox Browser

  • Install Firefox browser in your system if it is not installed
  • Next, open the Firefox browser and then click on the horizontal lines and select the Options.
    select-options-firefox-jmetr
  • Next, go to the Network Settings and click on the Settings.
    select-settings-under-network-settings-jmeter
  • Once you click on Settings, the Connection Settings page will open, as shown below.

cooection-settings-page-jmeter

  • When you initially open the Connection setting, by default, the Use System Proxy Settings will be selected.
    use-system-proxy-settings-jmeter
  • Select the Manual Proxy Configuration and then enter the port as 8888 and then enter the HTTP Proxy as 127.0.0.1 and click on the Also use This Proxy for FTP and HTTPS Checkbox and then click on Ok.
    select-manual-proxy-configuration-set-http-proxy-jmeter
  • So that we have set a proxy to our browser
  • Now go back to the Jmeter window and then click on the Start button to start recording.
  • Before recording anything that you have to ensure that you need to insert one certificate into your browser
  • If you want to connect through HTTPS and start recording securely, that specific https website need a certificate to trust you.
  • Without any certificate, you cannot record any https website.
  • And this certificate will be provided by the JMeter.
  • After configuring everything in the connection setting, just click on the start button in the JMeter, you can see the pop-up message. root-ca-certificate-jmeter
  • Now the Root CA certificate has been created in your JMeter bin directory.
  • Once you install that certificate in your firefox browser.
  • And when your browser interacts with HTTPs, and it recognizes that the certificate provided by the JMeter, then it works generally as expected.
  • Go to your browser, and when you are still in Option, search for a Certificate. And then click on the View Certificate option.
    select-view-certificate-in-jmeter
  • Next, go to the Authorities and then click on the Import. click-on-authorities-import-jmeter
  • After clicking on Import, go to your JMeter bin folder, there you can find the ApacheJMeterTemporaryRootCA certificate.
  • Once you find the certificate, click on Open, so that it will install the certificate into the browser. find-root-ca-certificate-folder-jmeter
  • After installing, the browser will Ask Do you want to trust "_JMeter Root CA for Recording for the following purpose?, then select the required checkbox and then click on Ok. do-you-want-to-trust-ca-crtificate-jmetr

The following example demonstrates the Test Recording using JMeter to generate scripts.

  • Launch your JMeter in your system
  • Click on the Start button to start Recording and then,
  • Go to the chercher.tech/practice link from the firefox browser, this is dummy links to practice
  • And next, select some items from each drop-down.
    selecting-elements-from-drop-down-jmeter
  • Next, go back to the JMeter and then click on the Stop button.
  • And if you click on the HTTPS Test Script recorder, you will find the recorded scripts.
    test-scripts-generated-jmeter

How to Use JMeter for Performance Testing

Recording the JMeter in Chrome using Blazemeter Extension

BlazeMeter provides developers with tools using the Amazon Elastic Compute Cloud (EC2) service that provides a mobile, web application, website, web-service, or database testing that can simulate thousands of users visiting a site simultaneously. BlazeMeter can be extended with a series of custom plugins.

To Add Blazemeter to the Chrome Extension, Go to the Google Search and search for Blazemeter Recorder Plugin. You can see the below page. and then click on Add to Chrome

blazemeter-load-testing-jmeter

And then, click on the Add Extension.

add-extension-jmeter

After adding BlazeMeter to the chrome, you will find the icon at the top of the Chrome Browser. If you click on that icon, you can find the pop-up window below.

blazemeter-icon-on-chrome-browser

Click on the BlazeMeter®v2.3.0, and then the below page will open. Next, click on the Start Testing Now.

click-on-start-testing-now-jmeter

After clicking on Start Testing Now button, the below page will open, First-time users, to register and create an account by entering valid credentials on the below page.

blazemeter-registration-page-jmeter

After entering credentials, click on Register with Google and then go to your register email id, the BlazeMeter has sent a verification mail.

Click on set your password and then Set your password to login to your BlazeMeter account.

click-on-set-your-password-jmeter

Set your password, After setting your password, you will see the below message.

blaze-meter-jmeter

Next, go to the chrome browser page and then click on the login, as shown below.

click-on-login-in-icon-jmeter

Enter your Email, Password and click on the login, after successful login you will find the below page

welcome-page-jmeter

Now go to BlazeMeter Icon, you can see your name from which name you are logged in.

profile-name-in-icon-jmeter

Next, Open the website from which you wanted to record the actions, I am recording the activities from Blazedemo.com website. So open the blazedemo.com website and then open the BlazeMeter Icon, as shown below.

open-blazemeter-and-icon-parallelli-jmeter

Next, enter the name of the Test as per your convenience, I am giving as DEMO and then click on the red button to start recording and perform any actions that you want to record.

After performing the actions, click on Stop recording and then click on the Save button.

stop-recording-and-click-on-save-jmeter

Once you click on the Save button and then select.JMX as shown below

select-jmeter-and-blazedemo-and-click-save-jmeter

After clicking on Save, the DEMO file will be extracted and downloaded, then save the downloaded File in your project folder.

demo-jmx-file-jmeter

Now launch the JMeter in your system and then click on the File-->Open.

open-downloaded-file-jmeter

Next, select the DEMO.JMX file and then click on Open

demo-jmx-file-in-project-folder-jmeter

Now the Demo test plan has been opened in the JMeter. You can click on the Test, and you will find all the steps.

demo-test-jmeter

If you click on the first step, you can see that the From and To cities which I have clicked.

from-and-to-steps-jmeter

And if you click on the second test script, you will find the details below.

second-steps-scenarios-jmeter

In the second step, you can see the details of the flight number, from port, price, and then to port and airline name, which I had clicked.

Recording using the BlazeMeter shows Save Option only if you register and log in; otherwise, the Save button will be disabled.

Thread Group in JMeter

Recording JMeter by using BadBoy Software

Badboy is a powerful tool designed to aid in testing and development of complex dynamic applications.

Badboy makes web testing and development easier with dozens of features, including a comprehensive yet straightforward capture/replay interface, powerful load testing support, detailed reports, graphs, and much more.

We have to follow the below steps :

  • First, we need to Download and Setup the Badboy tool in our system.
  • Record Script in the Badboy tool.
  • Export recording to the JMX format.
  • Use recorded Script in JMeter.
  • Let us start by downloading the Badboy tool.
  • Navigate to the website BadBoy Software
  • Once you navigate to the website, the below page will be displayed. Click on the Download button.
    click-download-button-jmeter
  • Once the software got downloaded successfully, save that File into your system.
    4a3e14a6-fdf9-4821-815a-8ddb32868c08
  • Open the .exe File and then install it into your system. Click on I Agree and then click on Install.
    install-badboy-software-jmeter
  • Click on the Yes to create a program in your systems Strat Menu.
    create-badboy-in-the-system-jmeter
  • Now go to the Start Menu and Search for Badboy, you will find the Badboy Software Icon.
    bad-boy-software-in-start-menu-jmetr
  • Double click on the Badboy and the badboy recording page will look like as below.
    badboy-software-page-jmeter
  • Enter the Website link from which you want to record the actions in the badboy software, as shown below. Here I am using https://performancetestingpractice.com/.
  • And then click on the Red Button and then click on the Green button to proceed further.
    click-on-red-button-to-start-recording-green-button-jmeter
  • Once you click on the green arrow mark, the website will be open, that you can be noticed in the left corner.
    click-on-scenario-registor-jmeter
  • Next, you can click on the Scenario, and then Register.
  • Next stop the Recording. Once you click on the stop recording, you can see the all steps have been recorded, and you can notice that on the left side.
    steps-recorded-in-badboy-jmeter
  • Now, click on the File and then select Export to JMeter.
    export-to-the-jmeter
  • Next, Save the exported File into the project folder, as shown below.
    save-script-file-jmeter
  • Next, Launch JMeter in your system and then click on File and then select Open.
    open-script-jmx-file-jmeter
  • When I open the Script.jmx file, I am getting below. I will try to resolve this problem as soon as possible.
    error-in-opening-script-file-jmeter
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions