not really known
Go to file
2020-07-31 09:54:59 +02:00
doc docs 2016-07-18 16:12:21 -03:00
example Support for servant-0.13 2018-02-09 20:26:02 +02:00
src/Servant Update src/Servant/QuickCheck/Internal/QuickCheck.hs 2020-07-31 10:43:19 +03:00
test Support servant-0.16 and http-media-0.8 2019-04-16 22:19:54 +03:00
.gitignore Add predicate getsHaveLastModifiedHeader. 2016-10-03 15:39:46 +02:00
.travis.yml haskell-ci regenerate 2020-07-30 19:32:29 +03:00
cabal.haskell-ci Updates: 2019-09 2019-09-15 18:22:05 +03:00
cabal.project Support servant-server-0.18 2020-07-30 19:22:14 +03:00
CHANGELOG.yaml Bump version; add changelog entry. 2020-07-02 22:40:04 +02:00
LICENSE initial commit 2016-04-22 13:00:23 +02:00
README.md Add readme 2016-04-26 13:43:52 +02:00
servant-quickcheck.cabal haskell-ci regenerate 2020-07-30 19:32:29 +03:00
Setup.hs initial commit 2016-04-22 13:00:23 +02:00
stack.yaml Clean up stack.yaml and dependencies 2018-10-12 13:34:13 -06:00

servant-quickcheck

servant-quickcheck provides tools to test properties across entire APIs. Rather than writing the same tests for each endpoint, with servant-quickcheck you can simply specify properties every endpoint must meet once and for all. For example:

followsBestPractices :: Spec
followsBestPractices = describe "my API" $ do

  it "follows best practices" $ do
    withServantServer myAPI myServer $ \burl ->
      serverSatisfies api burl stdArgs
           ( not500
         <%> onlyJsonObjects
         <%> getsHaveCacheControlHeader
         <%> headsHaveCacheControlHeader
         <%> mempty)

Additionally, servant-quickcheck provides a serversEqual function that generates arbitrary requests (that conform to the description of an API) and tests that two servers respond identically to them. This can be useful when refactoring or rewriting an API that should not change.