Scripting with Visual Studio Code

This topic describes how to build and run DevWeb scripts using the Visual Studio Code (VS Code) editor.

Create DevWeb scripts in VS Code

When creating a DevWeb script using VS Code, you can use the provided VsCodeTemplate script as a base.

Alternatively, if you create a new DevWeb script from your own application, we recommend that you copy some of the files from the template script to your new script. This enables you to utilize extra functionality for the script in the VS Code environment.

Note: For Visual Studio Code 1.46.0 and later, an experimental debugger might be enabled by default. This debugger is not supported with DevWeb scripts.

Workaround: To debug, in the VS Code settings set ‘debug.javascript.usePreview’ to false.

To set up the VS Code environment:

  1. Set up your script, using one of the following methods:

    • Copy the VsCodeTemplate folder from <DevWeb root folder>\examples\ to a location on the same machine as DevWeb, and rename the copied folder.

      Or

    • Open the <DevWeb root folder>\examples\VsCodeTemplate folder, and copy the following files and folder to an existing DevWeb script folder:

      What to copy: Purpose:
      .vscode folder Enables you to view predefined tasks for the DevWeb script in VS Code.
      DevWebSdk.d.ts and tsconfig.json files Enables JavaScript SDK code completion for the DevWeb scripts in VS Code.
  2. In VS Code, open the script: Select File > Open Folder and open the relevant folder. Edit the script as required.
  3. Select Terminal > Run Tasks (in older versions of VS Code, select Tasks > Run Tasks), then select one of the options to record or generate the DevWeb script.

Note: The tasks use the environment variable DEVWEB_PATH, which should point to the DevWeb installation path. The environment variable is created automatically when DevWeb is installed with LoadRunner Professional or LoadRunner Enterprise.

Back to top

Run DevWeb scripts from VS Code

You can run your DevWeb script for up to 50 Vusers, using the DevWeb plug-in.

To run a script:

  1. Select Terminal > Run Tasks (in older versions of VS Code, select Tasks > Run Tasks).
  2. Select one of the run options.
  3. If any errors are discovered during the run, press CTRL+left mouse button to jump to the line where the error occurred.

Back to top

See also: