Step Reference¶
Request Construction¶
The requests which are sent as part of a test are constructed using a builder.
When a METHOD is sent to `PATH`- As every request to a REST API is likely to have a significant
HTTP
METHODandPATH, this step is considered required and is therefore used to send the built request. This should therefore be the last step for any given request that is built. When the request body is assigned:- The multiline content provided will be assigned to the body of the request. This will normally likely be the JSON representation of the data.
When the request query parameter `PARAMETER` is assigned `VALUE`- Assign
VALUEto the request query parameterPARAMETER. The value will be URL encoded and the key/value pair appended to the URL using the appropriate?or&delimiter. The order of the parameters in the resulting URL should be considered undefined. When the request header `HEADER` is assigned `VALUE`- Assign
VALUEto the request headerHEADER. Will overwrite any earlier value for the specified header, including default values or those set in earlier steps. When the request credentials are set for basic auth user `USER` and password `PASSWORD`- Assign HTTP Basic
Authorizationheader. Will overwrite any earlier value for theAuthorizationheader including those set in earlier steps.
Client Configuration¶
These steps modify the client in a way that will impact all requests sent, including any that are built and sent or issued during resource cleanup.
Given the client sets the header `HEADER` to `VALUE`- Include the header
HEADERwith value samp:{VALUE} on each sent request.
Resource Cleanup¶
See also
- Concept
- Resource Cleanup
When a resource is created at `PATH`- Mark
PATHas a resource to DELETE after the test is run.
Assignment¶
When `IDENTIFIER` is assigned `VALUE`- Assigns
VALUEtoIDENTIFIER. When `IDENTIFIER` is assigned a random string- Assigns a random string (UUID) to
IDENTIFIER. This can be useful to assist with test isolation. When `IDENTIFIER` is assigned a timestamp- Assigns to
IDENTIFIERa timestamp value representing the instant at which the step is evaluated. When `IDENTIFIER` is assigned the response (body|status|headers) [TRAVERSAL]- Assigns to
IDENTIFIERthe value extracted from the specified response attribute (at the optional traversal path).
Selection¶
See also
- Selection and Assertion
- Selection and Assertion
Then the value of the response (body|status|headers) [TRAVERSAL] is [not]- Select the specified response attribute (at the optional traversal path) of the current HTTP response.
Then the value of the response (body|status|headers) [TRAVERSAL] does [not] have any element that is- Select any (at least one satisfying) element from the structure within the specified response attribute (at the optional traversal path).
Then the value of the (body|status|headers) [TRAVERSAL] has elements which are all- Select all elements from the structure within the specified response attribute (at the optional traversal path).
Assertion¶
See also
- Selection and Assertion
- Selection and Assertion
Then it is equal to `VALUE`- Assert that the selected value is equivalent to
VALUE. Then it is matching `VALUE`- Assert that the selected value matches the regular expression
VALUE. Then it is including `VALUE`- Assert that the selected value includes/is a superset of
VALUE. Then it is empty- Assert that the selected value is empty or null. Any type which is not testable for emptiness (such as booleans or numbers) will always return false. Null is treated as an empty value so that this assertion can be used for endpoints that return null in place of empty collections; non-null empty values can easily be tested for using a step conjoined with this one.
Then it is of length `VALUE`- Assert that the value exposes a length attribtue and the value of that
attribute is
VALUE. Then it is a valid `TYPE`Assert that the selected value is a valid instance of a
TYPE. Presently this is focused on standard data types (initially based on those specified by JSON), but it is designed to handle user specified domain types pending some minor wiring and documentation. The current supported types are:ArrayBooleanDateTimeIntegerNumberObject- JSON style object/associative arrayString
Actions¶
See also
- Actions
- Actions
Given actions are defined such that- Collect subsequent steps as actions to be later performed.
Then the actions are [not] successful within a `$DURATION` period- Repeatedly attempt to perform collected actions over the course of
DURATION. Succeed if the actions are performed successfully, fail if the duration expires without a successful performance.