Behat API Extension
An open source (MIT licensed) Behat extension that provides an easy way to test JSON-based APIs in Behat 3.
Installation guide
End user guide
- Set up the request
- Given I attach
:path
to the request as:partName
- Given the following multipart form parameters are set:
<TableNode>
- Given I am authenticating as
:username
with password:password
- Given I get an OAuth token using password grant from
:path
with:username
and:password
in scope:scope
using client ID:clientId
(and client secret:clientSecret
) - Given the
:header
request header is:value
- Given the
:header
request header contains:value
- Given the following form parameters are set:
<TableNode>
- Given the request body is:
<PyStringNode>
- Given the request body contains
:path
- Given the response body contains a JWT identified by
:name
, signed with:secret
:<PyStringNode>
- Given the query parameter
:name
is:value
- Given the query parameter
:name
is:<TableNode>
- Given the following query parameters are set:
<TableNode>
- Given I attach
- Send the request
- Verify server response
- Then the response code is
:code
- Then the response code is not
:code
- Then the response reason phrase is
:phrase
- Then the response reason phrase is not
:phrase
- Then the response reason phrase matches
:pattern
- Then the response status line is
:line
- Then the response status line is not
:line
- Then the response status line matches
:pattern
- Then the response is
:group
- Then the response is not
:group
- Then the
:header
response header exists - Then the
:header
response header does not exist - Then the
:header
response header is:value
- Then the
:header
response header is not:value
- Then the
:header
response header matches:pattern
- Then the response body is empty
- Then the response body is an empty JSON object
- Then the response body is an empty JSON array
- Then the response body is a JSON array of length
:length
- Then the response body is a JSON array with a length of at least
:length
- Then the response body is a JSON array with a length of at most
:length
- Then the response body is:
<PyStringNode>
- Then the response body is not:
<PyStringNode>
- Then the response body matches:
<PyStringNode>
- Then the response body contains JSON:
<PyStringNode>
- Then the response code is
- Extending the extension