From b3a7b64c5cd16000959ca44e3538f1648f09051c Mon Sep 17 00:00:00 2001 From: "Julian K. Arni" Date: Tue, 26 Apr 2016 13:43:52 +0200 Subject: [PATCH] Add readme --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8dd7643 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# 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: + +``` haskell +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.