Function and Constant Prefixes

Functions and constants that use the C language syntax have prefixes that indicate the type of functionality. For example, general utility functions have an "lr" prefix, constants have an "LR" prefix, Web functions have a "web" prefix, FTP functions have an "ftp" prefix, and so on.

With object oriented languages, functions and constants require the object reference. When working with VuGen, the objects are sometimes created for you, and the object identifiers are hard coded. Common object references are "lr", "lrapi", and protocol specific objects like "web". Note that "web" is a child of "lrapi."

For example, the abort function in the C syntax is:


However, working within VuGen in Java, the function is:


The web function, add_auto_header, in C syntax is:


In Java, it is:


There are, however, cases in which the user instantiates an object. Where this is done, the identifier of that instance must be used.

For example, in the Java syntax for the ftp protocol, the ftp object is instantiated explicitly in the script. That reference must be used for method invocation:

myFTPobj = objectHelper.CreateObject("LoadRunnerFtp.FtpApi.1");

myFTPobj .ftp_delete("Ftp_Delete",

    "PATH=/pub/northanger/abbey.txt", ENDITEM , LAST);

When scripts are created with an external program, such as Microsoft Visual Studio.NET, methods are almost always invoked on user created objects. Constants are also members of those objects. In Microsoft Visual Basic.NET, for example:

Public Class VuserClass

' Initialize LR-API Interface

Dim lr As New LoadRunner.LrApi

' Initialize Web Interface

Dim lrWeb As New LoadRunner.WebApi

Initialize Utility Interface

Dim lrUtil As New LoadRunner.UtilityApi


Public Function Initialize() As Long

' Use LoadRunner.LrApi object, "lr"

lr.debug_message(lr.MSG_CLASS_BRIEF_LOG, _

    "Note both constant and function object reference")

' Use LoadRunner.WebApi object, lrWeb

lrWeb.url("weburl", "")