Given Steps
Autokin REST Steps
Given that a secure endpoint is up at {domain}
{domain}
This step is used to define that the scenario will connect to a domain API with secured or using HTTPS.
In the example above, we are defining that the API call will be at https://mysecuredomain.com.
Given that a endpoint is up at {domain}
{domain}
This step is the counterpart of the previous step, instead of using https this denotes that we are connecting to http only. Example, if the API is hosted at http://mydomain.com
Before any API call we need to have this Given step to specify the API domain and the protocol to use.
Given I set {name}
header to {value}
{name}
header to {value}
In most request HTTP headers are set to define the behaviour of the request. This step will add header information to our scenario. For example, we want to add HTTP header Content-Type with value of application/json.
In the above example, we add 2 headers to our request.
Given I set headers to
We can use this alternative steps to add multiple headers.
This adds 2 headers similar to the earlier example.
Given I set query parameter {name}
to {value}
{name}
to {value}
If we want to add query parameter to our request, we can use this step. For example, we need name query parameter with John as value.
Given I set query parameters to
If we want to set multiple parameters at the same time, we can use this step instead.
That should set our request with 2 query parameters.
Given I set the JSON body to
Now let say that we need to set the body of the request, we can do this using this step.
Given I set follow redirection to "true/false"
If you want to enable follow redirection to enable or disable.
Given I set form data to
If we want to add form data.
This will add form data to our request and include a header with Content-Type set to multipart/form-data.
Given I set encoded form data to
If we want to add encoded form data.
This will add form data to our request and include a header with Content-Type set to application/x-www-form-urlencoded.
Given I set the cookie to {cookie value pair}
{cookie value pair}
In some cases, request required some prepopulated cookies, so let's have some example.
This will create a cookie bounded to the domain that was previously sepcified.
Given I set cookie {name}
to {value}
{name}
to {value}
If we want to add cookie to our request, we can use this step. For example, we need name cookie with John as value.
Given I have basic authentication credentials {username}
and {password}
{username}
and {password}
Set basic authentication, can be as simple as the following example.
The step will automaticall add HTTP Header Authorization with Based64 encoded credentials.
Given I set the bearer token to {token}
{token}
Sets bearer authorisation token to our request.
So this will add HTTP Header as follows
Given I set the bearer token with {stored value name}
{stored value name}
Sets bearer token with a previously stored value. For example, in one of the previous API call we do a login, and from the sucessful response, we kep the session token as userSession, we can use this to chain our scenarios.
Given I set the request timeout to {timeout}
seconds
{timeout}
secondsOverrides the default timeout of the API request of 10 seconds. Timeout value are in seconds.
Last updated