Record and replay DevWeb scripts in VuGen

You can generate a DevWeb script in VuGen by building it from an existing HAR file, or by recording a business process using the DevWeb Proxy Recorder. You can then replay and debug the script.

Generate a script from a HAR file

You can generate a DevWeb Vuser script from a list of web requests compiled in a HAR network traffic file (capture file).

Note: In some cases, the browser does not save the response headers and body in the HAR file. These parts of the response are sometimes required during script generation (for example, for application of correlation rules), and if the relevant response information is missing, the script may be generated incorrectly.

We recommend using the DevWeb Proxy Recorder to generate HAR files for your scripts.

To generate a DevWeb script from a HAR file:

  1. Create a DevWeb Vuser script. For details see, Create and open Vuser scripts.
  2. Click the Record button on the VuGen toolbar to open the Start Recording dialog box.
  3. The Record into action field displays the only available option, Main.
  4. In the Record field, select Captured Traffic File Analysis.
  5.  In the Captured file field, browse to the HAR file location, or enter the path to the file.
  6. Select the required script Level, to generate a URL-based script, or pages with a resource-based script. (This option is displayed after a valid HAR file path is entered.)
  7. Click Start Recording. DevWeb's Offline Script Generator analyzes the capture file, generates the script content, and opens the Recording Report.

Back to top

Install CA certificate

To record HTTPS traffic with the DevWeb Proxy Recorder, you need to install a Certification Authority (CA) certificate. This should be done before using the DevWeb Proxy Recorder for the first time. You install the certificate into your certificate repository on the Proxy Recorder machine, as a Trusted Root Certificate.

You can use the default CA certificate supplied with the Proxy Recorder. If you want to use your own custom certificate, see Create custom self-signed certificate in the LoadRunner Developer and DevWeb Help Center.

To install the certificate using the Certificate Import Wizard:

  1. Open the certificates directory: \<LoadRunner Professional root folder>\bin\DevWeb\cert\default_devweb_cert certificates directory.

  2. Double-click default_devweb_cert. The Certificate Import Wizard opens.
  3. Follow the on-screen instructions. Leave empty the Password field for the private key.

Back to top

Record a script with the Proxy Recorder

You can record a business process locally or on a remote machine, using the DevWeb Proxy Recorder. DevWeb supports record and replay for scripts based on the transport level protocol (HTTP, HTTPS, and HTTP/2), and WebSocket protocol.

The Proxy Recorder creates a HAR file. DevWeb's Offline Script Generator then uses the HAR file to create a DevWeb script in VuGen.

Note:  

  • You may need to define proxy server settings for the Proxy Recorder, for example, if you recording behind a corporate proxy. Click Recording Options in the Start Recording dialog box and fill in the proxy details on the Proxy Recorder page. For details, see DevWeb > Recording Options.

  • If you want to record a server that is located on the local host (127.0.0.1/localhost), use the actual, local IP address in the address bar, so that the proxy recorder catches the data transportation.

    For example, if the machine IP is 12.12.12.12, instead of using http://localhost:<port> or http://127.0.0.1:<port>, use http://12.12.12.12:<port>.

To record a DevWeb script with the Proxy Recorder:

  1. Create a DevWeb Vuser script. For details see, Create and open Vuser scripts.
  2. Click the Record button on the VuGen toolbar to open the Start Recording dialog box.
  3. Optional: Click Recording Options and check the options that you want set for the recording. For example, you can set content and traffic filtering options, or enable correlation scans. For more information, see DevWeb > Recording Options.
  4. The Record into action field displays the only available option, Main.

  5. In the Record field, select Web Browser via DevWeb Proxy to record on the local machine, or to Remote Application via DevWeb Proxy to record on a remote machine.
  6. For local recording only: Select a browser from the dropdown Application list, and define the starting URL address.
  7. If required, change the value for the DevWeb Proxy listens on port field.
  8. For remote recording only: Leave the DevWeb Proxy IP field blank to use the default value, or select an option from the dropdown list.
  9. Select the required script Level, to generate a URL-based script, or pages with a resource-based script.

  10. Click Start Recording:

    • If recording in Chrome on the local machine, VuGen opens an incognito window (default).
    • If you are recording on a remote machine, manually open the required browser window. Configure the proxy settings for the browser, to specify the VuGen machine as the proxy server. Specify the VuGen machine address, and the port on which the DevWeb Proxy Recorder will listen.

    The DevWeb script recording toolbar is displayed, providing the main VuGen recording functionality options, including creating transactions during recording. For details, see Floating recording toolbar.

    Note: The ability to insert comments while recording is not included.

  11. When you have finished recording your business process, click Stop Recording. The script is generated from the created HAR file, and VuGen opens the Recording Report.

Tip: You can regenerate the DevWeb script, based on the created HAR file, and with changed settings applied. For example, you can enable correlation scans in the Recording Options, and then regenerate to add correlation extractors to the script. For more information, see Regenerate a Vuser script.

Back to top

Correlation for DevWeb scripts

DevWeb handles correlation for dynamic values using two methods: rule-based scans and record-based scans. Both add correlations to the generated code using extractors and appliers.

  • Rules scan: DevWeb includes a set of predefined, extendable rules for correlating dynamic values in standard environments. You can edit these rules and define new ones using the DevWeb recording options. You can also activate or disable the rules for your scripts. For information on the recording options, see Correlation rules node

    During code generation, if rules scan is enabled, then all activated rules are loaded from the correlation rule files. When a match is found, the relevant extractor is added to the web request step.

    The rules are defined in correlation rule files (*.yml). They are located (by default) in the ..\DevWeb\CorrelationRules\ folder.

    Note: The recommended way to edit correlation rules is using the recording options UI. However, you can also manually edit the correlation rule .yml files.

  • Record scan: When the record scan is enabled, DevWeb automatically scans the server responses for correlations. When it finds a correlation candidate, it adds an appropriate extractor to the web request step . The search is based on internal engine configuration settings.

For more information on the correlation scans, extractors and appliers, and working with correlation rules, see Corrrelate dynamic values in the LoadRunner Developer and DevWeb Help Center.

By default, the rules and record scans are disabled. For either or both correlation scans to occur, you must enable them in the Recording Options. For the record-based scan, you can define the preferred extractor type for plain text, Boundary or Regular expression. For details, see DevWeb > Recording Options.

After script generation, you can view correlation scan information in the Output pane:

And see the extractors in the script:

Back to top

Import DevWeb scripts

You can create scripts in LoadRunner Developer, taking advantage of its coding flexibility and integration with multiple IDEs. You can then import DevWeb scripts created in LoadRunner Developer into VuGen.

After import, the properties for the script can be viewed in the DevWeb runtime settings, and the script can be edited like any other DevWeb script created in VuGen.

To import a DevWeb script into VuGen:

  1. In VuGen, select File > Open > Import DevWeb Script.
  2. Browse to your script's main.js file and click Open.
  3. Enter a name for your script, and the location where you want to save the imported script.
  4. Click Import.

Back to top

Replay and debug DevWeb scripts

You can replay, edit, and debug your DevWeb scripts as you would other Vuser scripts, but with some differences specific to DevWeb:

  • Runtime settings. There is a dedicated runtime settings UI, to configure settings for DevWeb scripts, including run logic. For details, see DevWeb runtime settings.
  • Actions. As for other Vuser scripts, from Solution Explorer you can add new actions to your script, and rename them or perform other actions. Each added action is added to rts.yml. However, you cannot import actions.
  • Debugging. You can use most of VuGen's standard debugging features to identify and resolve errors when replaying your DevWeb Vuser scripts in VuGen, including conditional breakpoints and snapshot on error. For information on debugging in VuGen, see Debugging overview.

    When debugging DevWeb scripts, the VuGen toolbar contains an additional button to run the scripts: Replay without debug. This enables you to run the script to the end, without pausing script execution at breakpoints and other debugging points.

  • Snapshots. For information on working with DevWeb snapshots, see DevWeb snapshots.]

Replay

After replay, you can view replay information in the Output pane, and in the replay report for the script run in the Replay Summary pane.

Back to top

See also: