You can compile a .NET Vuser script to check its syntax, without running the script. To compile the script directly from VuGen, press Shift+F5 or select Vuser > Compile. If VuGen detects a compilation error, it displays the error in the Output window. Double-click on the error to go to the problematic line in the script.
To run the script directly from VuGen, press F5 or select Replay > Run. Breakpoints and step-by-step replay are not supported in VuGen's editor window for .NET Vusers. To debug a script and run it with breakpoints or step-by-step, run it from within Visual Studio .NET as described below.
Visual Studio provides you with additional tools to view, edit, and debug your Vuser scripts. You can add breakpoints, view variable values, add assembly references, and edit the script using Visual Studio's IntelliSense. You can also run the script in a step-by-step mode for debugging.
When you save your script, VuGen creates a Visual Studio 2010 solution file, Script.sln, in your script's folder. You can open the solution file in Visual Studio .NET and view all of its components in the Solution Explorer.
To open the Vuser script in Visual Studio 2010, select Design > Open Script in Visual Studio or click the Visual Studio button on the VuGen toolbar.
- If the Vuser script was created with an earlier version of LoadRunner (11 or earlier), LoadRunner will open the script in Visual Studio 2008.
- If Visual Studio 2010 is also installed, the script will be converted to a Visual Studio 2010 solution.
- If the script was created with LoadRunner 11.50 or later, it requires Visual Studio 2010.
Double-click the appropriate section in the Solution Explorer, such as vuser_init.cs, to view the contents of the script.
Note: VuGen automatically loads all of the necessary references that were required during recording. You can add additional references for use during compilation and replay through the Solution Explorer. Select the Reference node and select Add Reference from the right-click menu.
Click on globals.cs or globals.vb in the Solution Explorer to view a list of the variables defined and used by your script.