Share this page

# 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 script.

In this topic:

## 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:

1. Open a terminal window and change to the DevWeb root directory.

2. Run the following command:

   OfflineGenerator -mode=<mode type> -level=<script level> -config=<path to config file> <path to source file> <destination path>

   Use the key values below:

   Parameter | Description
   --- | ---
   mode | Define the mode type (har), to indicate the format of the file used to generate the script.
   level (Optional) | Define the script level to generate: a url-based script, or pages with a resource-based script. Value: url (default) or pages
   config (Optional) | 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).
   <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.

Example:

- 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`

Back to top

## Offline Script Generator configuration file (generator_config.yml)

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:

Area: | Use to:
--- | ---
Logger | Edit the default log level (info) and other logging options used during script generation.
Filter | Edit the filters for the generated web requests. These include: Deny lists for headers, hosts, URL patterns, and content, and allow list for hosts. You can use regular expressions for the filters. Exclude methods (CONNECT is excluded by default), response codes (404 is excluded by default), and WebSocket traffic. A filter for the display of generated WebRequest resources in the script. Use the showResources key to display all resources, only non-HTML body resources, or no resources. For details, see HTML parser for managing resources.
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.
General | Options include: Define the generated script type, for example, js or model. Generate the recording summary report (enabled by default). 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. Enable the generation of cookies and addCookies steps for web requests, if any web request cookies were not defined in previous responses. Enable generation of web requests with asynchronous send calls. Define the URL-encoded character set for query string and form values, for example, Shift-JIS encoding. (Default is UTF-8.) Enable the generateParallelCalls option to activate automatic grouping of asynchronous web requests issued concurrently. The requests are grouped into one block, within a promise.All statement. This provides better client behavior emulation during replay. (This functionality is provided as tech preview.) Note: To use the generateParallelCalls option, the HAR file must have a duration value. You can also specify the tolerance value (in milliseconds) for concurrent request groups. This extends the default timeframe duration, to include or exclude requests from concurrent groups. Enable the WebSocket buffer to be generated as a function instead of a const string.
har | Regenerate pages for HAR files (enabled by default).

Back to top

See also:

- Record and generate a script
- API testing

https://admhelp.microfocus.com Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Performance Engineering for Developers Help Center OpenText™ Performance Engineering for Developers Help 26.1 All View Local Help Center View Online Help Center Version: