behavioral testing tools - keep your application healthy with π
Resource are the objects that are going to be used for steps in the scenario. They are listed under the resources key in the pipeline configuration.
http client that can be used for sending http requests and comparing the responses
Initialize resource in config.yml:
- name: # name of the resource type: # | httpclient | params: # base url for the http client that will automatically be prepended to any route in the feature. base_url: # string # timeout for the request round-trip. timeout: # duration # stubs file path (`./stubs`) stubs_path: # string send an http request without a request body
Given $resource send request to $target send an http request with a request body
Given $resource send request to $target with body $body Given $resource send request to $target with payload $body send an http request with a request body from a file
Given $resource send request to $target with body from file $file Given $resource send request to $target with payload from file $file set request header
Given $resource set request header key $key with value $value check http response code
Given $resource response code should be $code check http response headers
Given $resource response header $header_name should be $header_value check response body
Given $resource response body should contain $body check response body
Given $resource response body should equal $body http wiremock server resource that mocks API responses
Initialize resource in config.yml:
- name: # name of the resource type: # | wiremock | params: # wiremock base url (e.g : http://localhost:8080) base_url: # string # stubs file path (`./stubs`) stubs_path: # string set a response code and body for any request that comes to the wiremock target
Given set $resource response code to $code and response body $body set a response code and body from a file for any request that comes to the wiremock target
Given set $resource response code to $code and response body from file $file set a response code and body for a given path for wiremock
Given set $resource with path $path response code to $code and response body $body set a response code and body for a given method and path for wiremock
Given set $resource with method $method and path $path response code to $code and response body $body set a response code for a given method and path for wiremock
Given set $resource with method $method and path $path response code to $code set a response code for a given method and path for wiremock
Given set $resource with method $method and path $path response code to $code and response body from file $file check requests count on a given endpoint
Given $resource with path $path request count should be $count database driver that interacts with a sql database
Initialize resource in config.yml:
- name: # name of the resource type: # | postgres | mysql | params: # sql driver (postgres or mysql) driver: # string # sql database source name (`postgres://user:pass@host:port/dbname?sslmode=disable`) datasource: # string truncates the target table and sets row results to the passed values
Given set $resource table $table list of content $content compares table content after an action
Given $resource table $table should look like $content messaging queue that that publishes and serves messages
Initialize resource in config.yml:
- name: # name of the resource type: # | rabbitmq | nsq | params: # queue driver (rabbitmq) driver: # string # queue source dsn (`amqp://user:pass@host:port/`) datasource: # string # stubs file path (`./stubs`) stubs_path: # string publish a message to message queue
Given publish message to $resource target $target with payload $payload publish a message to message queue from a file
Given publish message to $resource target $target with payload from file $file listen for messages on a given queue. Declaration should be before the publish action
Given listen message from $resource target $target count messages for a given target. Declaration should be before the publish action
Given message from $resource target $target count should be $count compare message payload by checking if the message contains other JSON. Declaration should be before the publish action
Given message from $resource target $target should contain $payload compare message payload by checking for exact JSON matches. Declaration should be before the publish action
Given message from $resource target $target should equal $payload to communicate with shell command
Initialize resource in config.yml:
- name: # name of the resource type: # | shell | params: # shell command prefixes prefix: # string execute shell command
Given $resource execute $command check stdout for executed command contains a given value
Given $resource stdout should contains $substring check stdout for executed command not contains a given value
Given $resource stdout should not contains $substring check stdout for executed command contains a given value
Given $resource stderr should contains $substring check stderr for executed command not contains a given value
Given $resource stderr should not contains $substring check exit code is equal given value
Given $resource exit code equal to $exit_code check exit code is not equal given value
Given $resource exit code not equal to $exit_code cache driver that interacts with a cache service
Initialize resource in config.yml:
- name: # name of the resource type: # | redis | params: # cache driver (only "redis" for now) driver: # string # cache source url (`redis://user:secret@localhost:6379/0?foo=bar&qux=baz`) datasource: # string set key to hold the string value
Given cache $resource stores $key with value $value compares cached content after an action
Given cache $resource stored key $key should look like $value check if such key exists in the cache
Given cache $resource has key $key check if such key doesnβt exists in the cache
Given cache $resource hasn't key $key