Request Dimensions and Variants
A request dimension (or just a dimension) is a variable aspect of a request. A variant is an option inside a dimension. What is a variable aspect of a request is decided by you as the tester of an API. The following are examples of common request dimensions:
| Dimensions | Variants | Variables | Explanation |
|---|---|---|---|
| Stage | Testing, Production | The API URL for the stage | APIs have different URL per stage. |
| Caller identity | Bob, Alice | The user id of the test user | The tester wants to test an API with different caller identities and credentials. |
| Owner identity | Bob, Alice | The user id of the resource owner | The API resources are owned by users, and the tester wants to test getting the resources of different owners. |
This document describes how to create and use request dimensions and variants.
Creating a dimension
To create a new request dimension in Inflight
- Click on "Dimensions" on the main navigation (under "Requests").
- Click on
...next to the project name and select "New Dimension". - Enter the dimension name (for example,
IP Version) in the dialog box and click on "Create" (or pressEnterkey).
The new dimension shows up in the list of dimensions.
Creating variants
After creating a new dimension, we need to create variants inside that dimension. The following is an example of creating 2 variants for the "IP Version" dimension we just created.
- Click on
...next to theIP Versiondimension and select "New Variant". - In the dialog box enter
IPv4and press theEnterkey. Inflight opens the new variant in a new tab. - In the variant UI, click on "Add variable":
- For name, enter
subdomain - For value, enter
ipv4
- For name, enter
We repeat the same steps for the second variant:
- Click on
...next to theIP Versiondimensions and select "New Variant". - In the dialog box enter
IPv6and press theEnterkey. Inflight opens the new variant in a new tab. - In the variant UI, click on "Add variable":
- For name, enter
subdomain - For value, enter
ipv6
- For name, enter
Using dimensions
This section describes how to use the dimension we just created:
- Start a new request by clicking on
+(or "New request") - For the request URL, enter
https://{{subdomain}}.google.com.- The
{{subdomain}}is called a request variable. - You can add multiple variables to a variant; however, all variants within a dimensions usually have the same variables.
- The request variables are replaced by the value of selected variant when the request is sent.
- The
- At the bottom of Inflight UI, click on
IP Versiondimension. This opens a list of available variants. - Select a variant and click Send to send the request.
Request variables
We've seen request variables in the previous section. This section provides a few more details about request variables.
- Request variables have the format
{{name}}, where name is the name of the variable. - When a variant is selected, Inflight automatically combines the variables in all the selected variants and resolve request variables.
- If a variable is not defined in any of the selected variants, then the variable is unresolved and Inflight shows that variable in red; otherwise, the variable is resolved and is displayed in blue.
- All request variable need to be resolved before a request can be sent; otherwise Inflight shows an error that a value is not resolved.
Update operations
In addition to adding variables to variants, dimensions and variants also supports the following
update operations that can be accessed using the object menu (...):
- Rename
- Delete
- Duplicate
When a dimension is deleted, all the variants inside that dimensions are deleted.
When dimensions or variants is updated, Inflight automatically recalculate the variables from all the selected variants.
Inflight uses internal ids to track dimension and variants; therefore, the rename operation does not affect selected variants. The UI will be updated accordingly.