curl-runnings-0.6.0: examples/example-spec.yaml
---
# The top level of the file is an array of test cases
- name: test 1 # required
url: http://your-endpoint.com/status # required
requestMethod: GET # required
# [Optional] Specify the json payload we expect here
# The 1 key in this block should be either:
# exactly | contains
expectData:
# The 1 key in this object specifies the matcher we want
# to use to test the returned payload. In this case, we
# require the payload is exactly what we specify.
exactly:
okay: true
msg: 'a message'
# [Required] Assertions about the returned status code. Pass in
# an acceptable code or list of codes
expectStatus: 200
- name: test 2
url: http://your-endpoint.com/path
requestMethod: POST
expectStatus:
- 200
- 201
# [Optional] json data to send with the request
requestData:
hello: there
num: 1
- name: test 3
url: http://your-url.com/other/path
requestMethod: GET
expectData:
# In the `contains` case of data validation, a list of matchers is specified. Currently,
# possible types are `valueMatch` | `keyValueMatch`.
contains:
# `keyValueMatch` looks for the key/value pair anywhere in the payload
# here, {'okay': true} must be somewhere in the return payload
- keyValueMatch:
key: okay
value: true
# `valueMatch` searches for a value anywhere in the payload (note: _not_ a key).
# Here, we look for the value `true` anywhere in the payload.
# This can be useful for matching against values where you don't know the key ahead of time,
# or for values in a top level array.
- valueMatch: true
expectStatus: 200
- name: test 4
url: http://your-url.com/other/path
requestMethod: GET
# Specify the headers you want to sent, just like the -H flag in a curl command
# IE "key: value; key: value; ..."
headers: "Content-Type: application/json"
expectStatus: 200
# The response must constain at least these headers exactly.
# Header strings again match the -H syntax from curl
expectHeaders: "Content-Type: application/json; Hello: world"
- name: test 5
url: http://your-url.com/other/path
requestMethod: GET
headers: "Content-Type: application/json"
expectStatus: 200
# You can also specify a key and/or value to look for in the headers
expectHeaders:
-
key: "Key-With-Val-We-Dont-Care-About"
- name: test 6
url: http://your-url.com/other/path
requestMethod: GET
headers: "Content-Type: application/json"
expectStatus: 200
# Specify a mix of full or partial header matches in a list like so:
expectHeaders:
- "Hello: world"
-
value: "Value-With-Key-We-Dont-Care-About"