How to Convert LoadRunner Tests to JMeter
It only takes a few quick steps to convert your LoadRunner scripts into JMeter format and start enjoying the benefits of Apache JMeter for your load testing activities.
Join the DZone community and get the full member experience.
Join For FreeIf you are moving from LoadRunner to JMeter, you might want to convert your existing tests into JMeter format. This article will guide you through the process so that you can to perform the transition smoothly and within minimum time.
Note: As of the current JMeter version 3.1, you will be able to convert the tests assuming only HTTP(S) protocol (and derivatives). In LoadRunner terms, they are:
Web — HTTP/HTML.
Web services.
Preparing JMeter for Recording
JMeter comes with a built-in proxy server that enables intercepting HTTP requests that flow through it and converts them into HTTP request samplers.
The easiest way to set up JMeter for recording is to use the JMeter Templates feature. JMeter can be set up for recording in just a few clicks. Just choose File > Templates > Recording from JMeter’s main menu and then click the Create button.
JMeter will populate a Test Plan that is suitable for HTTP(S) traffic recording. All you need to do is expand WorkBench > HTTP(S) Test Script Recorder and click the Start button.
Once you click the Start button, JMeter will show you a message telling that a certificate was created in JMeter’s bin
directory.
This doesn’t indicate any error; it is just an information message regarding the ApacheJMeterTemporaryRootCA.crt
certificate creation in JMeter’s bin
folder. If you are recording HTTP traffic, you can just ignore it. If you are about to record HTTPS traffic, you will need to install the certificate in your browser or mobile device. See the Recording HTTPS Traffic with JMeter's Proxy Server guide for more details.
If you didn’t change any default settings, JMeter’s proxy should be now running on port 8888 of the machine where JMeter lives.
Preparing LoadRunner for Recording
The whole idea of converting a LoadRunner test to JMeter is replaying a test in LoadRunner by using JMeter as a proxy so that JMeter can capture the requests and convert them to its own Test Plan format. Therefore, you need to “tell” LoadRunner to use JMeter as a proxy.
Open LoadRunner VuGen.
Open the script you want to convert into JMeter format.
Click Replay > Settings.
4. In Runtime Settings, locate Internet Protocol > Proxy and amend the configuration as follows:
Proxy: Use custom proxy > Use proxy server.
HTTP Proxy: enter the IP address or hostname of the machine where JMeter is running. If VuGen and JMeter are running on the same machine, type localhost there.
Port: 8888 (unless you changed the port in JMeter’s HTTP(S) Test Script Recorder).
If you will be recording HTTP(S) traffic, check Use the same proxy for all protocols box.
Make sure that Do not use a proxy server for local (Intranet) addresses is not checked!
5. Just in case, double check you have 1 iteration under General > Run Logic. There is no need to record test iterations; it is better to handle them in JMeter on the Thread Group level or with a Loop Controller.
That’s it! You can now hit F5 (or click Replay > Run) to kick off your LoadRunner test execution. JMeter will record all the HTTP requests and you will be able to observe them under JMeter’s Recording Controller. Here is what the recording process should look like:
Next Steps
Once you have test script “skeleton”, you will most likely need to manually correlate dynamic values by using JMeter PostProcessors (Regular Expression Extractor, CSS/JQuery Extractor, etc).
You can also use the BlazeMeter Proxy Recorder instead of JMeter’s HTTP(S) Test Script Recorder. BlazeMeter Proxy Recorder can export tests in “SmartJMX” mode. This mode will automatically detect any dynamic parameters and generate the relevant test logic to substitute hard-coded recorded values with the ones extracted from previous responses. This way, you won’t have to take any extra actions. See this How to Cut Your JMeter Scripting Time by 80% article for further details.
This is one way you can quickly convert your existing LoadRunner scripts into JMeter format and start enjoying the benefits of using free and open-source Apache JMeter for your Load Testing activities.
Published at DZone with permission of Dmitri Tikhanski, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments