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
:pathto the request as:partName - Given the following multipart form parameters are set:
<TableNode> - Given I am authenticating as
:usernamewith password:password - Given I get an OAuth token using password grant from
:pathwith:usernameand:passwordin scope:scopeusing client ID:clientId(and client secret:clientSecret) - Given the
:headerrequest header is:value - Given the
:headerrequest 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
:nameis:value - Given the query parameter
:nameis:<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
:headerresponse header exists - Then the
:headerresponse header does not exist - Then the
:headerresponse header is:value - Then the
:headerresponse header is not:value - Then the
:headerresponse 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