curl-runnings: A framework for declaratively writing curl based API tests

[ library, mit, program, testing ] [ Propose Tags ]

Please see the README on Github at https://github.com/aviaviavi/curl-runnings#readme


[Skip to Readme]
Versions 0.1.0, 0.2.0, 0.3.0, 0.6.0
Dependencies aeson (>=1.2.4.0), aeson-pretty (>=0.8.5), base (>=4.7 && <5), bytestring (>=0.10.8.2), case-insensitive (>=0.2.1), cmdargs (>=0.10.20), curl-runnings, directory (>=1.3.0.2), hspec (>=2.4.4), hspec-expectations (>=0.8.2), http-conduit (>=2.2.4), http-types (>=0.9.1), megaparsec (>=6.3.0), text (>=1.2.2.2), unordered-containers (>=0.2.8.0), vector (>=0.12.0), yaml (>=0.8.28) [details]
License MIT
Copyright 2018 Avi Press
Author Avi Press
Maintainer mail@avi.press
Category Testing
Home page https://github.com/aviaviavi/curl-runnings#readme
Bug tracker https://github.com/aviaviavi/curl-runnings/issues
Source repo head: git clone https://github.com/aviaviavi/curl-runnings
Uploaded by aviaviavi at Thu May 3 16:31:50 UTC 2018
Distributions LTSHaskell:0.6.0, NixOS:0.6.0, Stackage:0.6.0
Executables curl-runnings
Downloads 270 total (25 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-05-03 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for curl-runnings-0.6.0

[back to package description]

curl-runnings

Build Status

Feel the rhythm! Feel the rhyme! Get on up, it's testing time! curl-runnings!

curl-runnings is a framework for writing declarative, curl based tests for your APIs. Write your tests quickly and correctly with a straight-forward specification in yaml or json that can encode simple but powerful matchers against responses.

Alternatively, you can use the curl-runnings library to write your tests in Haskell (though a haskell setup is absolutely not required to use this tool).

Why?

When writing curl based smoke/integration tests for APIs using bash and curl is very convenient, but quickly becomes hard to maintain. Writing matchers for json output quickly becomes unweildy and error prone. Writing these sorts of tests in a more traditional programming language is fine, but certainly more time consuming to write than some simple curl requests. curl-runnings aims to make it very easy to write tests that just hit some endpoints and verify the output looks sane.

Now you can write your tests just as data in a yaml or json file, and curl-runnings will take care of the rest!

While yaml/json is the current way to write curl-runnings tests, this project is being built in a way that should lend itself well to an embedded domain specific language, which is a future goal for the project. curl-runnings specs in Dhall is also being developed and may fufill the same needs.

Installing

There are few options to install:

  • download the releases from the github releases page
  • install the binary with stack or cabal
  • build from source with stack

Writing a test specification

Write your tests specs in a yaml or json file. See /examples to get started. A test spec is a top level array of test cases, each item represents a single curl and set of assertions about the response.

Running

Once you've written a spec, simply run it with:

bash $ curl-runnings -f path/to/your/spec.yaml

If all your tests pass, curl-runnings will cleanly exit with a 0 code. A code of 1 will be returned if any tests failed.

For more info:

bash $ curl-runnings --help

Contributing

Curl-runnings is totally usable now but is also being actively developed. Contributions in any form are welcome and encouraged. Don't be shy! :D

Roadmap

  • [x] Json specifications for tests
  • [x] Yaml specifications for tests
  • [ ] Dhall specifications for tests
  • [ ] More specification features
    • [x] Reference values from previous json responses in matchers
    • [x] Environment variable interpolation
    • [ ] Call out to arbitrary shell commands in and between test cases
    • [ ] Timeouts
    • [ ] Support for non-json content type
    • [ ] Retry logic
  • [ ] A DSL for writing test specs