Load and Performance Testing: How to Use iMacros with JMeter
Using iMacros with JMeter, you can perform load tests with 100% realistic testing data to accurately reflect true end-user experiences. Most load testing tools simulate only the server side traffic that is generated by the browser at the HTTP layer. iMacros makes the difference by testing the complete web application inside the browser on the client side (iMacros Browser, Internet Explorer, Firefox and Chrome). This includes load testing websites with AJAX, Flash, Flex, Silverlight or Java applets. So, the metrics collected by JMeter when using iMacros render the overall browser execution time.
This approach requires that each simulated user has his own browser instance. You can run several instances of iMacros Browser at once, thus simulating concurrent users. This approach works very well for 1…50 users per average PC. The limit is only the number of IE or Firefox instances that can run on your machine. To run iMacros for Firefox with Multiple Profiles, you can use the Profile Manager or a batch file for creating profiles. A user profile in Chrome can be cloned by simply copying its content into a new folder.
Getting started is easy: To use iMacros with JMeter you do not need to install any plug-in.
All you need is to create a script to control iMacros, and build a Test Plan in JMeter that launches the script.
How to Launch iMacros from JMeter Using VB Script
1. Create a VB Script to Control iMacros
The iMacros Enterprise Edition automatically installs the Web Browser API (iMacros Scripting Interface). With these powerful commands you can easy write scripts (in a scripting language of your choice) that allow you to control iMacros. The following VB script is executing simple iMacros code for navigating to a web page:
Tip: Use the iMacros Editor Code Generator feature to convert your iMacros macros into scripting/programming language code.
2. Build a JMeter Test Plan
The next step is to build a Test Plan in JMeter. Add a Thread Group to your Test Plan to create multiple threads and change its values as desired. Each thread will have a single browser instance.
Add to the Thread Group an OS Process Sampler with the “cmd” command and the following two values:
The second value contains the path to your VB script. Finally, you need to add listeners, e.g. Summary Report, to display the test results.
How to Launch iMacros from JMeter Using Powershell and iMacros Browser
Instead of VBScript, it is possible to use PowerShell to control iMacros as the following example shows:
The PowerShell script can be launched in JMeter by adding an OS Process Sampler:
Notice that the PowerShell script takes as an argument the JMeter built-in variable __threadNum and displays the current thread number in iMacros.
Passing Arguments from JMeter to PowerShell and Running iMacros for Firefox
The following PowerShell script launches iMacros for Firefox using multiple profiles named f1, f2, f3…fn:
Using the built-in __threadNum variable allows you to associate each thread to a single browser instance. In JMeter you can also define user variables that can be passed to the PowerShell script, e.g. loopsNum that simply contains the total number of loops:
There is more in-depth information about the User Defined Variables on the JMeter documentation page.
Adding Listeners to View and Store the Test Results
The listener components display the collected performance and load test results of the samplers. The metrics can be shown in a tree, table, graph or log file:
Download scripting code and test plans:
Note: Consider changing the directory path in the JMeter samplers to where the scripts are stored.
Web Automation Blog
- With the release of iMacros 11.5, you can now c...
- This version is a major upgrade to iMacros for ...
- With this release, the youngest member of the i...