Migrating from LoadRunner (LR) to ALT and ZebraTester

This page is for those coming from LR and Converting their scripts to ZebraTester to be used in Apica Load Test (ALT).

All LR conversions are via ZebraTester.
To do so, please follow this step-by-step LoadRunner to ZebraTester conversion page.

Conceptual Differences

This table includes some of the conceptual differences between creating Scripts using LR and ZT.

LoadRunner (LR)

ZebraTester (ZT)

LoadRunner (LR)

ZebraTester (ZT)

Scripts

  • In LR, web scripts are created in ANSI C-code with the extension of many C methods to support all kinds of features.

  • The LR scripting tool (VUGen) compiles the scripts that run with low memory and CPU utilization on the LR Agents (LG).

  • In ZT, scripts are generated Java code that runs in a JVM on the Agent.

  • The memory utilization mainly consists of Java Heap memory from 100MB - 3GB.

Script Structure

  • An LR Script has, by default, three sections; all are separate C code files.

  • vuser_init        
    This part of the script is only executed once when the script starts (not in iterations >1)

  • Action
    This is the part of the script that is executed as long as a test is running.

  • vuser_end
    This part of a Script is only executed once when the script ends or if the Action part of the script fails and is interrupted.

  • ZT scripts are based on compiled Java code (class files) and as zip files when needed parameter files and jar files as an extension to Java Plugin code.

Script Recording

  • LR scripts can be recorded in several ways; for web Scripts, the most common way is using the MS Windows WinInet.

  • Wininet is an MS application and a DLL file used in the MS Windows OS and handles Internet communication from the users' browsers and other applications.

  • LR is using the application to catch all requests and responses that the users' browser is doing.

  • Since HTTPS connections are done on another SW level and not on the network level, LR does not need to create any needed certificates since it's breaking the connection between the browser and the target application.

  • ZT is using a Java proxy that all browser requests are passed through. As a consequence, ZT needs to create and use certificates for all HTTPS requests.

Scripting Features/Functions

  • LoadRunner has 100+ protocols, and this page only covers Web protocol that’s the most commonly used for web applications.
    In LR Scripts, most Script Functions/Features consist of many C code functions that cover several areas.
    To use a Function/Feature user adds a method call with the required parameters.

  • Web-script functions
    LR has 86 web C methods for creating advanced scripts (Examples of some are described below on this page).

  • Utility Functions
    To support all kinds of functionality in a Script LR comes with 106 Utility functions divided into the following topics.

  • Command Line Parsing Functions

  • Database Functions

  • Informational Functions

  • Message Functions

  • Parameter Functions

  • Run-Time Functions

  • String Manipulation Functions

  • Transaction Functions

  • XML Functions (LR_XML)

  • In ZT, Functions/Features are added using the ZT UI and cover many Functions/Features.

  • This is a major change for an LR user, going from mostly adding C code Functions/Features to using the ZT UI.

Modular Scripting

  • Since LR Scripts are based on C-code, users can mix included LR methods with custom code in the same script or use include files and re-use custom functions in many scripts.

Example
The user records a first Login Script that is logging in a user and sets some user attributes.
This Login Script is then used in 10 other scripts that all start with a login and set the user properties.
If the login page or the user properties is changed user only has to update the Login Script, and all other scripts will then use the updated script.
With the same situation in ZT, users need to open all 10 scripts and make the changes in all scripts.
Modular scripting makes a big difference when having a large number of scripts to maintain.

  • In ZT, Scripts are generated Java code, and all requests are generated from the same definition/settings in the ZT session.

  • Users can add and re-use Basic inline and Java Plugin code, but this code only covers utility functions and not the actual requests.

  • ZT also has the session cutter where parts of one script can be copied to another script.


Commonly used functions in LR Scripts

Here is a list of some of the most used LR methods used in web scripts.

LR Method

Example

LR Method

Example

web_global_verification()

  • This method is often used at the beginning of the script to fail the script execution if any of the tested application responses include a specific message.

  • If the exact text is not known or varies between pages, a left/right boundary can be used (TextSfx/TextPfx)

  • A call to web_global_verification_pause can temporarily suspend the check.

web_global_verification("Text/IC=System Unavailable","Fail=Found","Search=Body",LAST);

Several parameters can be used as if the search should be in the Header or the Body part of the response. The “Fail” parameter can be set to Found or NotFound depending on if the text should or not should be found in the server response.

lr_get_attrib_string()

Returns a string type value of an argument passed to the script run.

lr_get_attrib_long()

Returns a long integer type value of an argument passed to the script run.

lr_get_attrib_double()

Returns a double type value of an argument passed to the script run.

  • These methods are used to read parameters sent from the LR Controller to the LR Agents (LG) when a Scripts starts.

  • There is one method for each type of parameter.

  • This is often used to control the domain sub-domain in a Script so that the same script can be re-used for several test environments.

lr_get_attrib_string("P_Environment");

This method call fetched a String parameter from the Controller when the Script starts.
In the LR Controller, this is set by adding –P_Environment test.company.com

 

Work in Progress Below

web_set_sockets_option()

The web_set_sockets_option function configures options for sockets on the client machine. This function supports socket-level replay. In the Web HTML protocol, it supports both HTML-based scripts (Mode=HTML) and URL-based scripts(Mode=HTTP modes). web_set_sockets_option has no effect on replay using WinInet.

SSL_VERSION: The SSL version preference: 2, 3, 2&3, TLS, TLS1.1, TLS1.2, TLS1.3, or AUTO

SHUTDOWN_MODE: Controls how ports are shut down and disconnected from the TCPIP connection: GRACEFUL (default), FAST, or ABRUPT.

MAX_CONNECTIONS_PER_HOST: Specifies the maximum number of concurrent connections per host.

CLOSE_KEEPALIVE_CONNECTIONS: Closes all open connections.

web_set_sockets_option("SSL_VERSION", "TLS1.2");

web_set_sockets_option("SHUTDOWN_MODE", "FAST");

 

web_reg_save_param()

Registers a request to save dynamic data information to a parameter with a defined boundary-based match.

web_reg_save_param_regexp()

Registers a request to save dynamic data information to a parameter with a RegEx-based match.

web_reg_save_param("c_Smagnet", "LB=name=\"smagentname\" value=\"","RB=\" id=\"Hidden6\" />", LAST);
web_reg_save_param_regexp("ParamName=C_CertificateNumber","RegExp=<span class="boldF">Certificate/Member Number.*</span>\n\t\t\t\t\t<span>(\d+)",LAST);

web_reg_find()

The web_reg_find function registers a request to search for a text string on a web page retrieved by the next action function. The search does not apply to values returned as a result of calls to asynchronous or cross-step functions.

This function helps you verify whether or not the page you received is the desired page by searching for an expected text string.

web_reg_find("Search=Body","SaveCount=SearchCount","TEXT=Welcome to the eBenefits Web Portal",LAST);
web_reg_find("Search=Body","SaveCount=SearchCount","TEXT=Date of Service",LAST);

lr_start_transaction()

Marks the beginning of a transaction.

lr_end_transaction()

Marks the end of a transaction.

lr_start_transaction("GSvP_004_GetClaimDetails_01_Launch");
lr_end_transaction("GSvP_004_GetClaimDetails_01_Launch", LR_PASS);

lr_think_time()

Pauses execution between commands in a script.

lr_think_time(10);

web_add_auto_header()

Adds the specified header to all subsequent HTTP requests.

web_revert_auto_header()

Stops scripts from adding a specific header to subsequent HTTP requests.

web_add_auto_header("X-Requested-With","XMLHttpRequest");


web_revert_auto_header("X-Requested-With");

lr_error_message()

Sends an error message with location details to the output windows, log files, and other test report summaries.

lr_error_message("%s",lr_eval_string("GSvP_004_GetClaimDetails_02_Login failed for UserID: {P_UserName}, IterationNo {IterationNo}, VuserID {VUserID},GroupName {GroupName},LoadGenerator: {Host} at Time {Time}"));

lr_eval_string()

Returns the string argument after evaluating embedded parameters.

lr_eval_string("{c_ClaimNumber_%d}")

lr_save_string()

Saves a null-terminated string to a parameter.

lr_save_string(lr_eval_string(a),"c_ClaimNumber");

 

Return to ALT Main Feature Descriptions and Recordings

Cannot find what you're looking for? Send an E-mail to support@apica.io.