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, a Certification Authority (CA) certificate must be installed into the certificate repository on the Proxy Recorder machine, as a Trusted Root Certificate. This should be done before using the DevWeb Proxy Recorder for the first time.

Generate and install a unique CA certificate

Available in version 2021 R1:

The unique CA certificate DevWebCertDoNotTrust, described in this section, is supported from version 2021 R1.

If you are using the default CA certificate supplied with earlier versions, we recommend that you replace it with the unique CA certificate.

A unique DevWeb CA certificate, called DevWebCertDoNotTrust can be automatically generated and installed by the Proxy Recorder. Alternatively, you can generate and import the certificate using the DevWebUtils executable, without activating the Proxy Recorder. Administrator privileges are required to import and install the certificate.

You need to generate and import the certificate once, on each machine that VuGen is installed on. The imported certificate is then valid for one year.

When the certificate is generated, the cert directory is added to the DevWeb root folder (if it doesn't exist already), containing the following certificate and CA PEM files:

  • devweb_cert.cer

  • mitmproxy-ca.pem

  • mitmproxy-dhparam.pem (this file is created by mitmproxy and might not be included in the folder)

Tip: If certificate installation fails, you can try installing it manually using the Certificate Import Wizard (you need to have administrator privileges). Double-click the devweb_cert.cer file and follow the on-screen instructions.

To generate and install a unique CA certificate using the Proxy Recorder:

  1. Access the %DevWeb_data_path% and open the ro_recorder_config.yml file.
  2. Set provide_certificate to true.
  3. Save the file.
  4. When you record with the Proxy Recorder, the certificate is automatically generated and installed (if it does not exist already in the cert folder and the trusted root). You should be able to record HTTPS traffic.

To generate and install a unique CA certificate via DevWebUtils executable:

  1. To generate the certificate, from a terminal window change to the %DevWeb_data_path% and run the following:

    DevWebUtils.exe -mode=genCert

    This generates the certificate by default in <DevWeb_data_path>\cert.

  2. To import the certificate, make sure the terminal window is open with administrator privileges. Run the following:

    DevWebUtils.exe -mode=importCert

Install the default DevWeb CA certificate

Available in version 2021:

The DevWeb default CA certificate, described in this section, is supported up to version 2021.

For versions later than 2021, you should follow the instructions above to install a unique CA certificate.

 

You can install 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: \<DevWeb root folder>\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

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.

Version 2021 R1 update: Full code completion is available for the DevWeb protocol from version 2021 R1.

Note the following when working with DevWeb scripts:

  • 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.

  • Correlations. For information on DevWeb correlation, see Correlation for DevWeb scripts.
  • 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: