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

Generate and install a unique CA certificate

To record HTTPS traffic with the DevWeb Proxy Recorder, a unique DevWeb Certification Authority (CA) certificate must be installed into the certificate repository on the Proxy Recorder machine, as a Trusted Root Certificate.

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

The DevWeb CA certificate (called DevWebCertDoNotTrust) can be automatically generated and installed by the Proxy Recorder, either by defining the relevant option in the Recording Options, or by approving certificate generation before recording (see Record a script with the Proxy Recorder).

Alternatively, you can generate and import the certificate using the DevWebUtils executable, without activating the Proxy Recorder.

You need to generate and import the certificate once, on each machine that VuGen is installed on (administrator privileges are required to import and install the certificate). The imported certificate is then valid for one year.

When the certificate is generated, the cert folder is added to the %DevWeb_data_path% (if the folder doesn't exist there already), and contains 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.

Generate the CA certificate using the Proxy Recorder

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

  1. With a DevWeb script open in the VuGen Editor, select Record > Recording Options.

  2. On the Proxy Recorder page, expand Internet Settings and select Decrypt HTTPS traffic.

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

Generate the CA certificate using DevWebUtils

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

Troubleshooting for CA certificate generation

If there are any issues with generating and installing the certificate, administrators can try this method:

From the %DevWeb_data_path%, open the ro_recorder_config.yml file and set provide_certificate to true.

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 you want to record HTTPS traffic in the application under test, a DevWeb CA certificate must be installed on the machine. If there is no certificate, a warning dialog box may be displayed. Click OK in the dialog box to create and install the certificate, or Cancel to continue with the recording without a certificate.

      Tip: You can also set automatic CA certificate generation in the Recording Options. For details, see Generate and install a unique CA certificate.

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

    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.

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.

    There is no Step Navigator pane for DevWeb scripts.

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: