Editor pane
The Editor 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.
To access | The editor is opened when VuGen is loaded. |
Important information |
|
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 scripts.
In addition, the VuGen editor enables you to write manual scripts with the following programming languages:
-
Java: For details, see Java Vusers.
-
C#: For details, see Code a .NET script.
-
VB.NET: For details, see Create and View Vuser Scripts in Visual Studio.
Tips for Working with the Editor
-
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.
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 | The 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.
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.
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.
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 gutter enables you to add toggle 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 |
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 |
Comment. Inserts comments into your script. 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 |
From VuGen 2022 R2: 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. |
See also: