DevWeb Offline Script Generator tool
Use the DevWeb Offline Script Generator to generate an executable DevWeb script from a list of web requests compiled in a HAR or CSV file.
Tip: For details about recording HAR files for DevWeb, see Record and generate a DevWeb script.
Generate the DevWeb script
This section describes how to use the Offline Script Generator tool to generate a DevWeb script from a HAR file.
To run the Offline Script Generator tool:
Open a terminal window and change to the DevWeb root directory.
Run the following command:
OfflineGenerator -mode=<mode type> -level=<script level> -config=<path to config file> <path to source file> <destination path>
with the following key values:
Define the mode type (har), to indicate the format of the file used to generate the script.
Note: There is also swagger mode, used to generate files from Swagger specifications. For details, see API testing with DevWeb.
Define the script level to generate: a url-based script, or pages with a resource-based script.
Value: url (default) or pages
Provide the path to the configuration file from which to generate the script.
Note: If not provided, the default configuration file for this tool, generator_config.yml (located in the DevWeb root folder), is used. For more details, see Offline Script Generator configuration file (generator_config.yml) below.
<path to source file> Provide the full path to the HAR file from which to generate the script. <destination path> Provide the full path to the folder in which to save the generated script.
In the following example, pages with a resource-based script are generated from a HAR file:
OfflineGenerator -mode=har -level=pages myFile.har Scripts/MyScriptDirectory
In the following example, pages with a resource-based script are generated from a HAR file, using a configuration file:
OfflineGenerator -mode=har -level=pages -config=config/file.yml OfflineGenerator/input/HAR/json_pages.har C:\jsonPages
The default configuration file for the Offline Script Generator <DevWeb root folder>\generator_config.yml, contains configurations that are specific to the Offline Script Generator.
These configurations include:
- Logger area. Edit the default log level (info) and other logging options used during script generation.
- Analytics area. Edit usage analytics settings. For details, see LoadRunner Developer configuration.
- Filter area. Edit the filters for the generated web requests, including allow/deny lists for headers, URLs, and content. You can also exclude methods (CONNECT is excluded by default), response codes (404 is excluded by default), and WebSocket traffic.
- Correlation area. Apply correlation rules scan and/or correlation record scan during script generation, and edit default correlation settings, including preferred extractor type. For details, see Correlate dynamic values.
- Formatting area. Edit the default content types for XML or JSON body formatting, and the string lengths.
- General area. Generate the recording summary report (enabled by default).
You can also enable parameterize host names, so that the host names and IP addresses in the script are stored as parameters, and used to substitute the relevant occurrences in the script at runtime.
- har area. Regenerate pages for HAR files (enabled by default).
The file contains descriptions of each setting.