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:
- Create a DevWeb Vuser script. For details see, Create and open Vuser scripts.
- Click the Record button on the VuGen toolbar to open the Start Recording dialog box.
- The Record into action field displays the only available option, Main.
- In the Record field, select Captured Traffic File Analysis.
- In the Captured file field, browse to the HAR file location, or enter the path to the file.
- 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.)
- Click Start Recording. DevWeb's Offline Script Generator analyzes the capture file, generates the script content, and opens the Recording Report.
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:
-
With a DevWeb script open in the VuGen Editor, select Record > Recording Options.
-
On the Proxy Recorder page, expand Internet Settings and select Decrypt HTTPS traffic.
-
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:
-
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.
-
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.
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 recording 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:
- Create a DevWeb Vuser script. For details see, Create and open Vuser scripts.
- Click the Record button on the VuGen toolbar to open the Start Recording dialog box.
- 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.
-
The Record into action field displays the only available option, Main.
- 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.
- For local recording only: Select a browser from the dropdown Application list, and define the starting URL address.
- If required, change the value for the DevWeb Proxy listens on port field.
- For remote recording only: Leave the DevWeb Proxy IP field blank to use the default value, or select an option from the dropdown list.
-
Select the required script Level, to generate a URL-based script, or pages with a resource-based script.
-
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.
-
- 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.
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:
- In VuGen, select File > Open > Import DevWeb Script.
- Browse to your script's main.js file and click Open.
- Enter a name for your script, and the location where you want to save the imported script.
- Click Import.
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:
- 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.
See also: