How to Use Parameters
Parameters are very useful if you would like to execute multiple requests to the same internet resource, but with some slight difference, for example, different value of query string parameter for each request.
Parameters of various data types and generation types can be defined in project properties and then used in every project request item.
Applying parameters inside request item definition will also affect execution count of the request item, for example, if you have applied
parameter with five possible values, its execution count will automatically change to 5 and executing this item will produce five requests.
Applying parameters inside request item is the only way to change execution count value of request item.
If you would like to use parameters with particular request item, follow this procedure:
Open project properties from the main application menu or toolbar and switch to 'Parameters' tab.
In 'Parameters' tab, click 'Add new' button and then specify name for your parameter.
Change definition of your parameter in the right part of the window. In general, you have to specify which and how many values parameter will produce.
When you have completed your parameter definition, click OK button to apply project properties. Your new parameter is now created and stored inside the project.
Select request item in which you would like to use project parameters and open it for editing (menu option 'Edit Items').
Inside request item definition it is possible to use project parameters in the following fields:
You can use parameters in these fields in the following ways:
- Request body.
- Additional request headers.
Used project parameters must always be enclosed in curly braces otherwise HttpMaster will not recognize them as such and will process them as literal text.
- Type name of the parameter directly in the desired field and enclose its name in curly braces.
- Press 'Ctrl+Space' when inside the field. This will display a list of available parameters.
- Open list of available actions by clicking the corresponding button located next to the field. List of available actions will include menu option to display list of available parameters.
Apply changes to your request item and verify execution count value in the main application window for this item. Execution count of the item should now be changed according to the number of values that
all used parameters produce.
How execution count for request item is calculated
You can use any number of parameters inside request item. Execution count for request item is determined as scalar product of all used parameters. For example, if you have used three parameters in request item definition
(first produces three values, second produces five values, third produces eight values), then execution count of this request item will be 120 (3 * 5 * 8 = 120).
The same parameter can be used multiple times in single request item; if first parameter would be used twice, then total execution count for the request item would be 360 (3 * 3 * 5 * 8 = 360).
If parameters are not used in request item definition, its execution count will always be 1.
How execution count for request item is affected if parameter definition changes
If particular parameter is already in use in some of the request items and this parameter is changed in such a way that changes affect number of values it will produce,
execution count for all request items is automatically recalculated when parameter changes are applied (OK button click in project properties window).
How to rename project parameters
Parameters can be renamed anytime in project properties. If renamed parameters are in use in some of the request items, this rename will be reflected immediately in request item definition
after project changes are applied (request item properties will be updated with new names).
Even if request item is currently opened for editing in its own tab, UI controls where renamed parameters are used will be updated with new names immediately.
How to add project parameters after they have already been specified in request item
It is also possible to enclose some text in request item definition with curly braces even before parameter with such name exists in the project properties.
If you later create parameter with such name in project properties, HttpMaster will determine if some parts of request item properties can be matched with newly created parameter and will automatically connect them
if such matches are found.
Copyright © by Borvid. All rights reserved.