Download the PHP package ulff/behat-rest-api-extension without Composer
On this page you can find all versions of the php package ulff/behat-rest-api-extension. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ulff/behat-rest-api-extension
More information about ulff/behat-rest-api-extension
Files in ulff/behat-rest-api-extension
Package behat-rest-api-extension
Short Description Behat context for testing REST API calls
License MIT
Informations about the package behat-rest-api-extension
BehatRestApiExtension
Behat context for testing REST API responses, extending MinkContext. Currently it is supporting only JSON response types. Using that extension you can make HTTP calls to your REST API and strictly check the response status codes and contents.
Setting up
Step 1: Install extension
Install extenstion using composer:
Step 2: load extension
Add following to behat.yml:
Usage
Create your own context class as an extension for base class:
You can list available scenario steps by command:
Additional steps offered by extension:
When I make request :method :uri
Make request specifying http method and uri.
Examples:
When I make request :method :uri with following JSON content:
Make request specifying http method and uri and parameters as JSON.
Examples:
When I make request :method :uri with params:
Make request specifying http method and uri and parameters as TableNode. TableNode values can be also ParameterBag params.
Examples:
Then the response should be JSON
Checks if the response is a correct JSON.
Then the response JSON should be a collection
Checks if a response JSON is a collection (array).
Then the response JSON collection should not be empty
Checks if a response JSON collection (array) is not empty.
Then the response JSON collection should be empty
Checks if a response JSON collection (array) is empty.
Then the response JSON should be a single object
Checks if a response JSON is a single object, not a collection (array).
Then the response JSON should have :property field
Checks if response JSON object has a property with given name.
Examples:
Then the response JSON should have :property field with value :expectedValue
Checks if response JSON object has a property with given name and that property has expected value.
Examples:
Then the response JSON should have :property field with null value
Checks if response JSON object has a property with given name and that property has null value.
Examples:
Then the response JSON should have :property field with exact value :expectedValue
Checks if response JSON object has a property with given name and that property has expected exact value (including type).
Examples:
Then the response JSON should have :property field with value like :expectedValueRegexp
Checks if response JSON object has a property with given name and value matching given regexp.
Examples:
Then the response JSON should have :property field set to :expectedValue
Checks if response JSON object has a property with given name and that property has expected BOOLEAN value.
Examples:
Then the response JSON should have :property field with array :expectedArray as value
When response JSON is a single object, it checks if that object has a property with given name and that property is exact array as given.
Examples:
Then all response collection items should have :property field
When response JSON is a collection (array), it checks if ALL collection items have property with given name.
Examples:
Then all response collection items should have :property field with value :expectedValue
When response JSON is a collection (array), it checks if ALL collection items have property with given name and that properties have expected value.
Examples:
Then all response collection items should have :property field with exact value :expectedValue
When response JSON is a collection (array), it checks if ALL collection items have property with given name and that properties have expected exact value (including type).
Examples:
Then all response collection items should have nested field :property with value :expectedValue
When response JSON is a collection (array), it checks if ALL collection items have nested property with given path and that properties have expected value. For nesting property use "->" inside expected property name.
Examples:
Then all response collection items should have nested field :property with exact value :expectedValue
When response JSON is a collection (array), it checks if ALL collection items have nested property with given path and that properties have expected exact value (including type). For nesting property use "->" inside expected property name.
Examples:
Then all response collection items should have :property field set to :expectedBoolean
When response JSON is a collection (array), it checks if ALL collection items have property with given name and that properties have expected BOOLEAN value.
Examples:
Then the response JSON :fieldName field should be a collection
When response JSON is a single object, it checks if that object has a property with given name and if that property is a collection (array).
Examples:
Then all nested :collectionFieldName collection items should have :nestedFieldName field
When response JSON is a single object, it checks if that object has a property with given name, and that property is a collection (array), and all of that collection items have nested field with given path.
Examples:
Then all nested :collectionFieldName collection items should have :nestedFieldName field set to :expectedValue
When response JSON is a single object, it checks if that object has a property with given name, and that property is a collection (array), and all of that collection items have nested field with given path and given BOOLEAN value.
Examples:
Then all nested :collectionFieldName collection items should have :nestedFieldName field with value :expectedValue
When response JSON is a single object, it checks if that object has a property with given name, and that property is a collection (array), and all of that collection items have nested field with given path and with given value.
Examples:
Then all nested :collectionFieldName collection items should have :nestedFieldName field with exact value :expectedValue
When response JSON is a single object, it checks if that object has a property with given name, and that property is a collection (array), and all of that collection items have nested field with given path and with given exact value (including type).
Examples:
Then all nested :collectionFieldName collection items should have nested :nestedFieldName field with value :expectedValue
When response JSON is a single object, it checks if that object has a property with given name, and that property is a collection (array), and all of that collection items have nested field with given path and given value. For nesting property use "->" inside expected property name.
Examples:
Then all nested :collectionFieldName collection items should have nested :nestedFieldName field with exact value :expectedValue
When response JSON is a single object, it checks if that object has a property with given name, and that property is a collection (array), and all of that collection items have nested field with given path and given exact value (including type). For nesting property use "->" inside expected property name.
Examples:
Then exactly one nested :collectionFieldName collection items should have :nestedFieldName field with value :expectedValue
When response JSON is a single object, it checks if that object has a property with given name, and that property is a collection (array), and exactly one of that collection items have nested field with given path and with given value.
Examples:
Then at least one nested :collectionFieldName collection items should have :nestedFieldName field with value :expectedValue
When response JSON is a single object, it checks if that object has a property with given name, and that property is a collection (array), and at least one of that collection items have nested field with given path and with given value.
Examples:
Then the response JSON should have nested :nestedFieldName field with value :expectedValue
When response JSON is a single object, it checks if that object has a property with given path and given value. For nesting property use "->" inside expected property name.
Examples:
Then the response JSON should have nested :nestedFieldName field with null value
When response JSON is a single object, it checks if that object has a property with given path with null value. For nesting property use "->" inside expected property name.
Examples:
Then the response collection should count :expectedValue items
When response JSON is a collection (array), it checks the number of items in collection.
Examples:
Then at least one of the collection items should have field :fieldName with value :expectedValue
When response JSON is a collection (array), it checks if any collection item has field with given value.
Examples:
All versions of behat-rest-api-extension with dependencies
behat/behat Version ^3.1
behat/mink Version ^1.7
behat/mink-extension Version ^2.2
behat/symfony2-extension Version ^2.1
codifico/parameter-bag-extension Version dev-master