TruWeb Offline Script Generator tool
Use TruWeb's Offline Script Generator to generate an executable TruWeb script from a list of web requests compiled in a HAR or CSV file.
Tip: For details about recording HAR files for TruWeb, see Create TruWeb scripts from recordings.
Generate the TruWeb script
This section describes how to use the Offline Script Generator tool to generate a TruWeb script from a HAR or CSV file.
Note: TruWeb supports CSV files from StormRunner Load (LoadRunner Cloud) only, and not other CSV formats. For details on the supported SRL CSV format, see Create a test using a CSV file in the StormRunner Load Help Center.
To run the Offline Script Generator tool:
Open a terminal window and change to the TruWeb installation directory.
Run the following command:
OfflineGenerator -mode=<mode type> -level=<script level> -config=<path to config file> <path to source file> <destination path>
Indicates the format of the file used to generate the script.
Value: har or csv
Determines the script level to generate: a url-based script, or pages with a resource-based script.
Value: url (default) or pages
<path to config file>
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 TruWeb installation folder), is used. For more details, see Offline Script Generator configuration file (generator_config.yml) below.
|<path to source file>||The full path to the HAR/CSV file from which to generate the script.|
|<destination path>||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 following example generates the script from a CSV file, using a configuration file:
OfflineGenerator -mode=csv -config=config/file.yml OfflineGenerator/input/CSV/example-csv-file.csv C:\csv-file
The Offline Script Generator configuration file (located in the TruWeb installation folder), contains configurations that are specific to the Offline Script Generator.
These configurations include:
- Logging options during script generation
- Filtering for the generated web requests which can include specific headers or specific URLs
- Correlation rules to apply during script generation - see Correlation rules definition file (correlation_rules.yml) below
- Special body formatting
- Summary report generation
For more information about the configuration settings, see the generator_config.yml file (in the TruWeb installation folder) where you can see descriptions of the settings alongside each setting.
This file is located in the <TruWeb installation>\CorrelationRules\ folder.
Tip: If you have correlation rule files in .cor format, you can convert them to .yml format using the Correlation Rule Converter tool.
The following is an annotated version of a correlation_rules.yml file:
categories: - name: category1 #The name of the category, not used in code, this is for the user enabled: true #Allows the user to enable or disable all the rules in a category rules: #A list of rules - name: myRule1 #The name of the rule, used in the code the user writes to identify the rule. Must be unique across all categories type: boundary #The type of rule. Can be "boundary", "regexp", "json" enabled: true #Allows the user to enable and disable particular rules options: #The options particular to this rule type leftBoundary: abc #Left boundary of the boundary-based correlation rightBoundary: efg #Right boundary of the boundary-based correlation - name: myRule2 type: regexp enabled: true options: expression: "[0..9]*" #The regular expression. For details, see https://github.com/google/re2/wiki/Syntax flags: "im" #The flags of the regular expression - name: category2 enabled: true rules: - name: myRule3 type: json enabled: true options: path: abc #The JSONPath. For details, see http://goessner.net/articles/JsonPath/