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

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 DevWeb Help Center.

To install the certificate using the Certificate Import Wizard:

  1. Open the \<LoadRunner root folder>\bin\DevWebProxyRecorder\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.
  • 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. The rules are defined in correlation rule files (*.yml), that you manually configure. They are located (by default) in the ..\DevWeb\CorrelationRules\ folder.

    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.

  • 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 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 DevWeb Standalone, taking advantage of its coding flexibility and integration with multiple IDEs. You can then import DevWeb scripts created in DevWeb Standalone 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

DevWeb has a dedicated view in runtime settings, to configure settings for your script. To open it, select Replay > Runtime Settings > DevWeb Settings.

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.

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.

A replay summary is displayed at the end of the replay information in the Output pane.

For information on debugging in VuGen, see Debugging Overview.

Back to top

See also: