BlazeMeter’s Google Chrome Extension allows you to test your application without prior scripting knowledge, by recording user actions and HTTP requests to create a unique test artifact that runs both JMeter and Selenium tests.
The extension offers two modes: Record and FollowMe. In this article, we will focus on the Record mode. To read about the FollowMe mode, click here.
- Record Mode
- How to Record a Test
- How multi tab recording for Selenium scripts works
- Blazemeter Script Editor
- How to Download the Recording
This mode automatically records in parallel performance and functional tests by creating both JMeter and Selenium scripts that can be tested locally or directly on BlazeMeter
First, let’s review the basic options available when you first open the extension:
The options pictured above include:
- ENTER THE NAME OF THE TEST - Type the desired name of your test in this field.
- Start recording - This button starts recording both HTTP(s) requests and Selenium actions for the test.
- Stop recording - This button stops recording the test.
- Download the recording - This button is grayed out until a test has been recorded, then is enabled once a recording has stopped, at which point clicking it will allow you to choose what type of script to download the recording as:
- Taurus YAML of JMeter & Selenium - for Load and UX combined
- Selenium only - for UX only
- JMX - for Load only
- Reset all options - This button resets everything, discarding any recording and settings and reverting the menu to its default state when you first opened it.
The above options are all you need to record a simple script, but there are additional advanced options available when needed. Click the following “Advanced Options” heading to expand it:
These Advanced Options are specific to HTTP(S) calls. You’ll first notice that you will need to scroll in order to view all options in this section, so we will split them across two screenshots as we review them.
The above-pictured settings include:
- Concurrency - Set the number of concurrent (simultaneous) users you want performing the actions you’re recording. The number you set for this option is the maximum concurrent users you’ll be able to run during the test. (The number of concurrent users you can use depends on the terms of your BlazeMeter plan.)
- Load Origin - Where do you want your users to come from? Our load servers are set around the world so that you can simulate the most relevant traffic according to your needs.
- User Agent - Select your preferred User Agent, by which we mean what device or browser your users are using. This will add a “User-Agent” header in to the requests, and it allows you to emulate various situations, such as a user browsing via a mobile device.
Now let’s scroll down to the next set:
Continuing on to the next settings pictured above:
- Filter Pattern - By default, requests are not filtered; however, by modifying the match pattern in this field you can change which requests your browser will include. Only requests which match the match pattern will be included (for example, you may elect to restrict requests to only one domain).
Note: Refer to Google’s guide on creating match patterns, because the field is very important, given that you likely do not wish to record your Gmail, Facebook, or even BlazeMeter traffic. If you did, though, don’t worry! You’ll be presented with the option to select which domains to include and exclude before the test actually runs.
- Disable Browser Cache - Checking this box will disable the browser’s cache during the recording. This option is especially important since cached objects are not recorded.
- Record AJAX Requests - Check this box if the site uses AJAX which needs to be included in the recording.
- Update Settings Before Running Test - When checked, this option enables you to change test settings prior to running. Through the BlazeMeter interface, you can control properties such as ramp-up time, test duration, load distribution between engines, and much more.
- Run as API Functional Test - If checked, this option will automatically check the “Run as Functional API Test” option in the newly created API test within BlazeMeter, which you will see take effect once you run the test in BlazeMeter and observe the resulting configuration, as seen in the below example:
Now let’s scroll down to the final advanced options, grouped under “Requests to Record”:
As pictured above:
- Only Top-Level Requests - If selected, the recorded script will not include requests for referenced objects. Once the script is executed it will parse the HTML file and send requests for all referenced objects.
- Top Level Requests and the Following - If selected this option will expand to show various items which can be checked for inclusion. The recorded script will include requests for referenced objects. Once executed, the script will not parse the HTML file and likewise will not send requests for referenced objects. Here is an example of the choices that appear once this option is selected:
Now that we’ve outlined all of the available options, let’s walk through creating a simple recording.
- Once installed, click the BlazeMeter icon in your Chrome browser’s toolbar:
- Login to your BlazeMeter account if you haven’t already. You can verify the plugin is logged in via the “Hi [username]” greeting in the upper right-hand corner:
- Give your test a name.
- Expand and set advanced options if desired (else leave them in their default settings).
- Click the Start recording button.
- The UI will change to show your yet-to-be-performed first step. Note that on the right-hand side there is a UI column and a JMX column, both of which start at (0).
- Perform the actions in your application you wish to simulate in your test (for example: browse to a site, click on a selection, fill out a form, submit the form, etc.). Note that as you do so, the UI number will increase to reflect UI actions you performed on a user-level, and the JMX number will increase to reflect how many items are created within the performance script to do the same.*
- To this point, every action you perform is being recorded to a “Test Step” (which you can rename by clicking the label). If you record everything to this step, it will be a monolithic script with a sequence of actions. On the JMX level, this will simply create a thread group consisting of these actions. The recorder, in fact, treats each step as a single transaction controller, so if you prefer, you may add additional steps to group subsequent actions under their own transaction controllers. Simply type in the name of the next step, then click Save.
The example above will appear as follows in the resulting JMX:
- Use the Pause recording button at any time you need to pause the recording.
The button will change to Record so that clicking it a second time will unpause, resuming the recording.
- While the recording is paused, you may right-click any element on your webpage to add various types of assertions to your test steps via the available context menu that appears. You’ll see that once you add an assertion, the UI count for the step you added the assertion to will increment by one.
(Note: Only add assertions while the test is paused, else the recorder will include the clicks you performed to open the context menu.)
- Once finished, click the Stop recording button.
- Now you can choose to download, edit, or run the test in the cloud.
* The UI count and JMX count will often not match. This is because what might take a human multiple mouse-clicks (go to URL, expand the menu, selection option, click submit button) may translate into fewer, simpler actions to the machine (a GET followed by a POST) or the opposite, where just one user-action can cause multiple requests.
When recording a Selenium scenario the BlazeMeter Chrome extension takes into account the following scenarios:
1. If you open new tab, Chrome Extension adds "openWindow" command to your script record with default new tab url of Chrome. Chrome Extension will "remember" this tab and focus of recording will be switched to this tab using the "selectWindow" command.
2. If you switch to another existing tab "openWindow" will be recorded together with the current URL of that tab. Chrome Extension will "remember" this tab and focus of recording will be switched to this tab using the "selectWindow"command.
3. If you close tab "close" command will be recorded, then browser automatically switches to another existing tab (see 2. for behavior of switching to existing tab).
4. The last case is when you switch between tabs that have already been part of the recording. In this case Chrome Extension won't add "openWindow" command because it "remembers" the tab. Instead only the "selectWindow" command will be added to the recording.
Instead of downloading the recording as-is, you may wish to further edit your script, for which two options are provided:
Let’s take a look at each option.
Load Testing: Edit your script for JMeter
Click this option and you’ll see a new tab open to display the JMeter script editor.
The topmost three buttons allow you to select what format you would like to export your script in. You can export the script as a Taurus YAML file or Taurus JSON file, or you can export it as a JMeter JMX file. Just click the corresponding button, and the script will be automatically converted and downloaded to your computer.
The buttons in the red bar allow you to expand all fields, collapse all fields, undo a change, or redo a change, respectively.
To the left of each item is a button you can click and drag to move the item up/down in the script, and a button that opens a menu of various additional options for customizing your script, as seen here:
Lastly, the play button in the upper-right corner will allow you to run your edited script on BlazeMeter.
Functional Test: Edit your script for Selenium
Click this option to open the recording in the BlazeMeter Selenium Debugger, which allows you to edit the commands (for changing values and element targets) and to replay your recorded steps using a playback feature.
The first four buttons are your main controls for replaying your script.
These buttons include:
- Resume replay - Click this button to begin or resume a replay of your script. You can then watch the Debugger perform the recorded actions in your browser.
- Pause replay - While the replay is running, click this button to pause it.
- Stop replay - Click this button to completely terminate the replay.
- Adjust the replaying speed - Click this button to open a drop-down menu of options which allow to slow down or speed up the recording, or set it back to normal speed.
As the test replays, it will keep track of the success/failure of each action in the right-hand column.
Editing your recorded script is equally simple.
Click and drag the button to the left of the action to reorder it, or right-click the button to open a drop-down menu that will allow you to duplicate the action, delete the action, or add/remove a breakpoint during the replay.
You can click the upper right-hand Add Command button at the top of each group of actions to add a new action. This will add a new row at the bottom of the group, in which you can manually enter a command, target, etc.
Once you begin typing over “Command name” with an actual command, a pop-up menu will appear showing possible commands to use.
You can edit existing actions by clicking the down arrow to the right of each action, which opens a drop-down menu with various options. This arrow will only appear for certain types of actions, depending on if variables/parameters can be modified.
Once you are finished editing your script, the buttons in the upper right-hand corner provide options for exporting it**.
These buttons include:
- Load JSON file - This button allows you to load an existing JSON file from disk into the Debugger.
- Export to a JSON file - Click this button to export your edited script to a JSON file.
- Export to .yaml - Click this button to export your edited script to a Taurus YAML file.
Now that your script is recorded, you may immediately download the recording.
You will then be prompted to select the type of script to export the recording as, which can be exported as one of the following:
- A Taurus YAML script consisting of both JMeter and Selenium tests simultaneously.
- A Taurus YAML script consisting of only a Selenium test.
- A JMeter-only JMX script.
If you selected additional options for Requests to Record earlier, then you will be prompted to select additional options pertaining to which domains to include in the exported script.