How to convert a LoadRunner scenario to Gatling open source?

How to convert a LoadRunner scenario to Gatling open source?

 

LoadRunner from Microfocus is a performance testing tool that has been in use for many years and is one of the most popular tools in the load testing space. Being a commercial tool, the initial purchase price of the software coupled with the cost of licensing for running tests beyond 50 virtual users makes it both expensive and prohibitive.

Adopting an alternative tool such as Gatling could be an extremely cost-effective solution. Beyond the financial aspect, switching could also significantly improve the quality of your software development and testing process by incorporating a developer-friendly tool that enables you to easily shift-left your testing.

A quick comparison at a high level of both tools:

Gatling vs Loadrunner

If you were to consider switching from LoadRunner to Gatling, you may be wondering how you
could leverage your existing LoadRunner scripts to work with Gatling.
In this article, we will show you two ways in which this can easily be achieved.

Method 1: HAR File Conversion

The first, and easiest, way to achieve this is through the use of a HAR file. Assuming that you
already have existing scripts in LoadRunner, after replaying the script simply select “Save HAR
File” to save the LoadRunner script as a HAR file.

 

The next step is to convert that HAR file into a Gatling script. To do that, we will first install Gatling by downloading and extracting the bundle from here. Open the bin folder in the extracted bundle, and run the recorder.bat (or recorder.sh on Mac) file to launch the Gatling Recorder.
Inside the Gatling Recorder, change the Recorder Mode to HAR Converter. Browse to the HAR file that you saved from the LoadRunner script and click Start. The Gatling Recorder will now generate a Gatling script and save it in the designated output folder. You can open this file in your favorite IDE or text editor and begin editing it right away.

Evaluation recorder - Gatling

Method 2: Replay LoadRunner Script

An alternative method to converting a LoadRunner script for use with Gatling is by using the proxy recorder feature of the Gatling Recorder. Start by downloading the Gatling bundle (as described in method 1 above) and launch the Gatling Recorder.

Inside LoadRunner, open the Runtime Settings and then Proxy. This is where we will configure LoadRunner to send traffic to the Gatling Recorder for capture. Choose use custom proxy then use proxy server. Fill localhost in the first field and ensure that the listening port is set to 8000 (or whatever port you specified in the Gatling Recorder). Set the number of iterations to run as 1.

Now click Replay in LoadRunner and the script will be executed, with the traffic captured by the Gatling Recorder. Once the LoadRunner script executed has finished, click on Stop & Save in the Gatling Recorder and your Gatling simulation file will be created. You can now open this simulation file in any text editor or IDE and begin editing it.

Summary

Whichever of the above methods you choose to convert your LoadRunner scripts to Gatling, the process is straightforward. Once your script is ready, you will want to edit it for any customisations that are required and to also modify the injection profile for the script (i.e. the number of users to run and their arrival rate).

Be sure to check out the Gatling documentation for clear step-by-step instructions and examples of doing this.

If you have further questions on how to migrate from LoadRunner (or any other testing tool) to Gatling, or if you want to get in touch with us for more information, simply fill in the contact form here.

For more information
Gatling Open-Source

The Gatling team

Posted in Tech
Posted on 13 April 2020