Dredd is a command-line tool for testing API documentation written in API Blueprint format against its backend implementation. With Dredd you can easily plug your API documentation into the Continous Integration system like Travis CI or Jenkins and have API documentation up-to-date, all the time. Dredd uses the Gavel for judging if a particular API response is valid or if is not. If you are curious about how decisions are made, please refer to Gavel's behavior specification.
$ dredd blueprint.md http://api.myservice.tld
See dredd-example repo for real-life example.
$ npm install -g dredd
$ dredd --help
Usage:
dredd <path to blueprint> <api_endpoint> [OPTIONS]
Example:
dredd ./apiary.md http://localhost:3000 --dry-run
Options:
--hookfiles, -f Specifes a pattern to match files with before/after
hooks for running tests [default: null]
--names, -n Only list names of requests (for use in a hookfile). No
requests are made. [default: false]
--reporter, -r Output additional report format. This option can be used
multiple times to add multiple reporters. Options:
junit, nyan, dot, markdown, html.
[default: []]
--output, -o Specifies output file when using additional file-based
reporter. This option can be used multiple times if
multiple file-based reporters are used.
[default: []]
--header, -h Extra header to include in every request. This option
can be used multiple times to add multiple headers.
[default: []]
--sorted, -s Sorts requests in a sensible way so that objects are not
modified before they are created. Order: CONNECT,
OPTIONS, POST, GET, HEAD, PUT, PATCH, DELETE, TRACE.
[default: false]
--user, -u Basic Auth credentials in the form username:password.
[default: null]
--inline-errors, -e Determines whether failures and errors are displayed as
they occur (true) or agregated and displayed at the end
(false).
[default: false]
--details, -d Determines whether request/response details are included
in passing tests.
[default: false]
--method, -m Restrict tests to a particular HTTP method (GET, PUT,
POST, DELETE, PATCH). This option can be used multiple
times to allow multiple methods.
[default: []]
--color, -c Determines whether console output should include colors.
[default: true]
--level, -l The level of logging to output. Options: silly, debug,
verbose, info, warn, error.
[default: "info"]
--timestamp, -t Determines whether console output should include
timestamps.
[default: false]
--help Show usage information.
--version Show version number.
Additionally, boolean flags can be negated by prefixing no-
, for example: --no-color --no-inline-errors
.
Dredd can be configured to use hookfiles to do basic setup/teardown between tests. See the wiki article on writing hooks for more details.
Dredd can test only API resources specified by well defined transaction. Any Non specific resources in the Blueprint e. g. with URI template or query parameters without default or example values are considered as ambiguous transaction thus they are resulting in a warning during the test run and are skipped.
To learn more about the future of API Blueprint & Testing visit apiaryio/api-blueprint#21.
Any contribution is more then welcome! Let's start with creating your own virtual development environment, then fork, write tests, write clean, readable code which communicate, use scripts/bdd
, keep the test coverage and create a pull request. :)
Make sure to follow Dredd issues page.