Gabbi is a tool for running HTTP tests where requests and responses are expressed as declarations in YAML files. Extensive documentation is available.
This container hosts the command line interface to gabbi, called gabbi-run. Test files may be provided over STDIN or a directory mounted into the container.
The latest tag will always have the latest release of gabbi, automatically produced whenever a new release of gabbi is made. Other tags follow semver, mapped to the gabbi version.
Some examples:
$ docker run -it cdent/gabbi:2 -h
usage: runner.py [-h] [-x] [-q] [-r [RESPONSE_HANDLERS]] [-v {all,body,headers}] [-k] [--unsafe-yaml] [target] [prefix]
Run gabbi tests from STDIN
positional arguments:
target A fully qualified URL (with optional path as prefix) to the primary target or a host and port, : separated. If using an IPV6 address for the host in either form, wrap it in '[' and ']'.
prefix Path prefix where target app is mounted. Only used when target is of the form host[:port]
options:
-h, --help show this help message and exit
-x, --failfast Exit on first failure
-q, --quiet Produce no test runner output
-r [RESPONSE_HANDLERS], --response-handler [RESPONSE_HANDLERS]
Custom response handler. Should be an import path of the form package.module or package.module:class.
-v {all,body,headers}, --verbose {all,body,headers}
Turn on test verbosity for all tests run in this session.
-k, --insecure Turn off ssl certificate validation.
--unsafe-yaml Turn on recognition of Python objects in addition to standard YAML tags.
Given the following YAML in /tmp/test.yaml
tests:
- name: post anything
POST: /anything
request_headers:
content-type: application/json
data:
foo: bar
response_json_paths:
$.json.foo: bar
Run it as:
$ docker run -i cdent/gabbi:2 http://httpbin.org < /tmp/test.yaml
... ✓ gabbi-runner.input_post_anything
----------------------------------------------------------------------
Ran 1 test in 0.311s
OK
If you have a directory of test files, in this example /tmp/tests/test.yaml and /tmp/tests/test2.yaml`, they can be mounted into the container.
$ docker run -it -v /tmp/tests:/work -w /work cdent/gabbi:2 http://httpbin.org -- $(cd /tmp/tests ; ls *.yaml)
... ✓ gabbi-runner.test_post_anything
----------------------------------------------------------------------
Ran 1 test in 0.392s
OK
... ✓ gabbi-runner.test2_put_anything
----------------------------------------------------------------------
Ran 1 test in 0.313s
OK
This can make gabbi's output a bit more readable as the filenames are used in the output. However, we need the the -w (workdir) and strange echo trick to glob the files in the directory. There's probably a better way to do this! Suggestions welcome!
Content type
Image
Digest
sha256:f11e88071…
Size
29.8 MB
Last updated
over 1 year ago
docker pull cdent/gabbi