not really known
Go to file
Joachim Desroches 4f24452d03
Add forgotten predicates to export list.
The honoursAcceptHeader and getsHaveLastModifiedHeader predicates had
been omitted when writing the export list, making it necessary to import
Servant.QuickCheck.Internal.Predicates to have access to them.
2017-12-15 00:22:57 +01:00
doc docs 2016-07-18 16:12:21 -03:00
src/Servant Add forgotten predicates to export list. 2017-12-15 00:22:57 +01:00
test Support for servant-0.12 2017-11-08 10:49:31 +02:00
.gitignore Add predicate getsHaveLastModifiedHeader. 2016-10-03 15:39:46 +02:00
.travis.yml Use new-build based .travis.yml 2017-11-08 11:39:45 +02:00
CHANGELOG.yaml Support for servant-0.12 2017-11-08 10:49:31 +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 Add build-tool-depends 2017-11-08 13:02:46 +02:00
Setup.hs initial commit 2016-04-22 13:00:23 +02:00
stack-lts-6.yaml Switch CI to stack 2017-03-10 15:53:26 -06:00
stack-lts-7.yaml Switch CI to stack 2017-03-10 15:53:26 -06:00
stack-lts-9.yaml Tentatively support Servant 0.11 2017-10-18 14:36:45 +02:00
stack.yaml Bump HSpec to 2.4.4 and make tests use safeEvaluateExample to capture failure msg 2017-07-15 15:03:06 -07: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.