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:

  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>

    with the following key values:

    mode

    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.

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

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 configurations that are specific to the Offline Script Generator.

These configurations include:

  • Logger area. Edit the default log level (info) and other logging options for 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.
  • Recording summary generation and regenerate pages for HAR files. Enabled by default, the settings can be disabled.

The file contains descriptions of each setting.

Back to top

See also: