Editor pane

The VuGen Editor pane enables you to edit scripts and other related script files. In addition, you can open a browser session to search sites, such as the LoadRunner Professional Forum.

Supported programming languages

Recorded scripts are generated in C, which has full language and parsing support in VuGen. You can enhance your Vuser scripts by adding standard ANSI C functions. ANSI C functions allow you to add comments, control flow statements, conditional statements to your Vuser scripts. You can add standard ANSI C functions to any type of Vuser script. For details, see C Vuser protocol.

In addition, the VuGen Editor enables you to write manual scripts (and in some cases, convert recorded scripts) using the following programming languages:

Back to top

About working with the Editor

When working in the Editor, other interface panes, such as the Output, Error, and Snapshot views, synchronize their displays based on your location in the script.

Script modifications are displayed as highlighted text in the Editor. For example:

  • Script has been modified but not saved.

  • Script has been modified and saved.

  • Breakpoint has been inserted.

Note the following shortcuts and tips:

  • Press Ctrl +Tab to display a list of tabs and panes. Highlight and click to switch tabs in the Editor.

  • Press Ctrl +Tab to display a list of tabs and panes. Highlight and click to switch tabs in the Editor.

  • Press Ctrl + G or select Search > Go to... to go to a specific line in the script.

  • Double-click an asset in the Solution Explorer to open it in the Editor.

  • Drag any type of file into the Editor and modify it. To save your changes, select File > Save File As.

Back to top

Code completion and tooltips

Code completion (autocomplete) enables you to quickly and accurately write code by providing a list of code items from which you can select options. Press CTRL + SPACE to activate statement completion when your cursor is in the Editor. Tooltips appear when you hover over a code element with your mouse.

The following table describes available code completion items, scope, identifying icon, and tooltip context:

Code completion item Scope Icon Tooltip displays
ANSI C Keywords and Types All possible standard C keywords. Function type, name, and parameters
LR API Functions All steps in the script. LR API Step
LR API Constants Used to delimit groups of parameters in steps. For example, ENDITEM LR API Constant
User Functions All the functions that you have defined in action files.

• Function type, name and parameters.

• When Using Functions (Method Insight)

The required arguments, highlighting each argument as you define it moving to the next argument when you enter the delimiter.

Variables

Local variables – visible only in the function where they have been defined.

Global variables – defined outside of any function body. Available everywhere in the script.

Type and name.
Parameters Available only in the function body where they have been defined.

• Parameter type and name

• When Using parameters (Method Insight)

The required arguments, highlighting each argument as you define it moving to the next argument when you enter the delimiter.

By default, VuGen uses code completion globally. To disable code completion, select Tools > Options > Editor Tab > Code Completion. Clear the Enable code completion features check box.

Back to top

Code coloring

To facilitate script writing and debugging, code item types are colored by an identifying background and foreground. The colored text enables you to easily read scripts and scan for syntax errors.

The following table provides examples of code item types and their assigned colors.

Code type Color example
Comments /* comment */ // comment
Keywords if (a) { } else { }
Method Parameter Name foo( "parameter=value" )
API function web_url
Method Call foo( )
String char * text = "Hello, World!"

In addition, you can customize code item types to suit your needs by selecting Tools > Options > Editor Tab > Code Color.

Back to top

Script folding

Script folding enables you to selectively hide and display sections of a script, making it easier to manage large scripts by viewing only those sections that you are currently editing. For details, see Editor Options tab.

Back to top

User interface elements

The following table describes the Editor user interface and the right-click (context) menu options. Unlabeled elements are shown in angle brackets.

UI Element Description
<Gutter>

The editor's gutter, located to the left of the line numbers, enables you to add switch functionality including:

Class/Function Browser

When enabled, you can navigate quickly to a specific class or function in your script by selecting it from the drop-down list in the browser.

Line numbers Display of line numbers in the script.
Context menu
Comment or Uncomment Enables you to comment or uncomment highlighted script lines.
Decode with DFE Applies to Web - HTTP/HTML. For details see, Data format extensions (DFEs) overview.
Show Snapshot Shows the snapshot associated with the highlighted script step.
Show Arguments When the cursor is placed on a function, the Step Properties dialog box appears with the details of the function's arguments.
Correlate Selection

Opens Design Studio and scans for dynamic values to be correlated in the selected script section.

Restore Masked String (value)

Restores the original value for a masked string.

Mask String

When the cursor is placed in a password, for example, inserts an lr_unmask function to encode the string.

Surround with Transaction Inserts an lr_start_transaction function immediately above the highlighted script and a lr_end_transaction function immediately below the highlighted script.
Go to Step in Replay Log Navigates to the location in the Output pane that correlates to the function in the Editor.
Insert

Use the Insert menu item to add one or more of the following steps at the location of the cursor: (Depending on your script and the location of the cursor, not all options will be available.)

  • New Step.

  • IStart Transaction.

  • End Transaction.

  • Surround with Transaction. For details, see Using transactions.

  • Rendezvous point. For details, see Rendezvous points.

  • REST API.. For details, see Create a script for a REST API.

  • Comment. Adds a comment with the relevant delimiters.

  • Log Message. Inserts an lr_log_message step into your script.

Toggle Breakpoints Adds or removes a breakpoint.
Search Community Opens the default Community Search browser.
Xpath Convert

Converts an XML query expression for a default namespace to the updated format, which includes the wildcard (*).

For details, see Example Scripts for XML Queries in the Function Reference.

Back to top

See also: