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 to use when generating 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 parameters that are specific to the Offline Script Generator.
The file contains descriptions for each parameter. The options include:
|Logger||Edit the default log level (info) and other logging options used during script generation.|
|Filter||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||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||Edit the default content types for XML or JSON body formatting, and the string lengths.|
|har||Regenerate pages for HAR files (enabled by default).|