Parameters can be used to dynamically generate data for the request. For example, you can define integer parameter with minimum and maximum value of 1 and 10, respectively and an increment of 1. If you then include this parameter in, for example, URL of particular request item, ten different requests will be executed. For more information on using parameters in request item properties, see the
corresponding topic.
Important
Parameters can be managed in the
Parameters tab of project properties.
Add parameter
To add parameter, click
Add new button in the toolbar located above parameter list. New parameter with default name is automatically added to the list. Name of the parameter must contain only alphanumeric characters or underscore, you can safely rename parameter even after it is in use by request items and name will be changed everywhere parameter is used.
Important
Parameter names in particular project must be unique.
Important
Because parameters and chaining items can be used in the same properties of request item, HttpMaster does not allow project parameters and chaining items to share the same name.
Specify parameter properties
Properties of the parameter are managed in the pane located next to the parameter list. You have the following options:
- Parameter data source.
- Parameter data type.
- Parameter format; only available when parameter data source is set to increasing values.
Manually provided single value
For all parameters of this type, you have two options:
- Use the following value; HttpMaster will use the specified value, but you will be able to change it anytime in the execution window.
- Prompt for the value before the execution; HttpMaster will display special window immediately before the execution where you will be able to specify parameter values. Specified values are maintained while the project is open; once parameter values are provided, you won't be prompted again for their values on subsequent executions. To change already provided parameter values, click corresponding button in the execution window toolbar and specify new values.
Important
Parameters defined as
Manually provided single value parameters can be temporarily changed during the execution. For a detailed tutorial on managing parameters during the execution, see the
corresponding topic in
How to section.
Values obtained from a disk file
If you have selected disk file as a data source, you have to specify the following properties:
- File path; path relative to the open project file can be used to specify disk location of the file.
- File encoding; character encoding in which file is stored.
-
Obtain data option; it is possible to obtain complete file contents or only part of it. The following options are available:
-
Obtain complete file contents as a single value; this option will use complete file contents as a parameter value.
-
Obtain single value with JSONPATH expression; this option will try to obtain single value from a JSON file and use it as a parameter value. You have to enter JSONPATH expression in the Expression field and file must contain JSON data. If data cannot be obtained with the specified query expression, empty string will be used as a parameter value.
-
Obtain single value with XPATH expression; this option will try to obtain single value from an XML file and use it as a parameter value. You have to enter XPATH expression in the Expression field and optionally specify namespace prefix and URI. File must contain XML data. If data cannot be obtained with the specified query expression, empty string will be used as a parameter value.
-
Obtain single or multiple values with the regular expression containing capturing groups; this options will try to obtain one value for each capturing group that you have specified in your regular expression. If you use multiple capturing groups, multiple values will be extracted and parameter will produce multiple executions for request items that use it. For example, if you have specified three capturing groups in your regular expression, request items that use this parameter will produce three executions, each time with a corresponding captured value. You can also specify whether you want case-sensitive or case-insensitive regex matching (Match case option).
Specified list of values
If you have selected list values as a data source, you can enter new values in the corresponding text field (one value per row). When you will use this parameter with request item, multiple executions will be generated by default, one for each parameter value. If you would like to change this, you can set desired behavior in
Behavior drop down. Two options are available:
- Generate multiple requests; this is the default value and will generate one execution per list value.
- Generate single request; this option will always generate a single execution by randomly picking one value from the list.
Runtime generated increasing values
If you have selected increasing values as a data source, you have to specify the following properties:
- Data type; Number and Date/Time data types are available.
- Format; select desired format from the dropdown.
- Decimal symbol; only available with Number data type.
- Digit grouping symbol; only available with Number data type.
-
Start value; specify start value for the parameter. You can specify negative value if the parameter data type is Number.
-
End value; specify end value for the parameter. You can specify negative value if the parameter data type is Number.
-
Increment; specify increment value. Only positive value can be specified.
- Increment unit; only available if parameter data type is Date/Time.
Runtime generated random value
If you have selected random value as a data source, you have to specify the following properties:
- Data type; Number, Date/Time, and Guid data types are available.
- Format; select desired format from the dropdown.
-
Minimum value; specify minimum value for the parameter. You can specify negative value if the parameter data type is Number. This field is not available for Guid data type.
-
Maximum value; specify maximum value for the parameter. You can specify negative value if the parameter data type is Number. This field is not available for Guid data type.
Important
If the same random parameter is used in multiple places in a single request item, all parameter occurrences will have the same runtime value during a single execution. In other words, runtime value for a single random parameter is determined only once during a single request item execution.
Using parameters
When you will use parameters in the fields that accept them, you will have to enclose them in curly braces, for example,
http://www.example.com?size={size}. To show the list of currently available parameters, press
Crtl+Space when cursor is inside the field that accepts parameters. One such field, for example, is URL of the request item.
For a step-by-step tutorial on using parameters, see the
corresponding topic in
How to section.