@contract-case/contract-case-jest
v0.28.0
Published
ContractCase contract testing suite
Maintainers
Readme
ContractCase Contract Testing Framework

Briefcase sticker created by Gohsantosadrive on Flaticon
Read the documentation here.
ContractCase is a next-generation consumer-driven contract testing framework, building on many of the lessons from maintaining the excellent Pact contract testing framework. It is our belief that contract testing is the best way to get deployment confidence for your applications and services.
Feedback welcome on github!
Caveats and limitations
ContractCase is now available and should work for both client and server driven http/https contracts. Feedback on the ContractCase API / DSL and (especially) naming conventions very welcome. However, the following caveats should be kept in mind:
- ContractCase is currently only available in Javascript / Typescript and Java. At a later date, support for Python, C# and Go will be added. There are no plans to add other languages at this time.
- ContractCase doesn't currently support merging of contracts. This means that each contract must be defined in one test file (per contract).
- ContractCase currently is only compatible with Jest (js/ts) and JUnit (java).
- ContractCase currently only has minimal broker support. It supports the Pact broker, although the Pact broker isn't able to render ContractCase contracts in the UI.
Although the test coverage is high, and great care has been taken to ensure that the results are correct, there may still be bugs. Please open an issue if you experience any problems.
You can follow the detailed progress by reading the maintainer todo list. These caveats will be updated as progress is made.
I'm fine with all the caveats, how do I get started?
If you want to get started immediately, we recommend starting with the defining contracts documentation.
npm install --save-dev @contract-case/contract-case-jestYou may also need jest:
npm install --save-dev jestFor Pact users
ContractCase has a very similar philosophy to Pact, and to maximise Pact compatibility, ContractCase works with the Pact broker. We recommend either:
- The Pact Broker for users wanting to host their own broke
- The excellent Pactflow Broker for those needing SaaS and enterprise features
There are a few key differences - ContractCase is easier to extend, can express more complex contracts, and can define contracts at either the server side or the client side (although it is always consumer driven - your consumer just might be consuming requests). See for Pact users for more discussion.
Roadmap
- Pact Parity (complete)
- Server driven contracts (complete)
- Plugins and arbitrary extensions (complete)
- Support java (complete)
- Support function-based contracts (complete)
- Documentation (in progress)
- gRPC matchers
- Support Python, C# and Go
- Arbitrary combinations of request/response pairs, incidentally including native SQS support
- Pass-through APIs
For the gory details of the roadmap, you can see the implementation notebook / todo list here
Releases
ContractCase releases follow semantic versioning, with two additional restrictions:
- Before 1.0.0, ContractContractCase is in Beta, and the API is considered unstable. Breaking changes will be indicated in minor version bumps- that is, 0.2.0 and 0.3.0 are not entirely compatible.
- Before 1.0.0, patch versions will always be backwards compatible.
Breaking changes will always be detailed in the changelog.
