Skip to content

case-contract-testing/contract-case

Repository files navigation

ContractCase Contract Testing Framework

Build and test Coverage Status Known Vulnerabilities OpenSSF Best Practices

DSL (these are the packages you want to install):

Node:

npm

Java:

Maven Central

Case

Briefcase sticker created by Gohsantosadrive on Flaticon

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.

Read the documentation here.

Feedback welcome on github!

ContractCase is now available and allows defining contracts for:

  • An HTTP Client
  • An HTTP Server
  • A function caller
  • A function implementation

Caveats and limitations

Feedback on the ContractCase API / DSL and (especially) naming conventions very welcome. However, the following caveats should be kept in mind:

  1. ContractCase doesn't currently support merging of contracts. This means that each contract must be defined in one test file (per contract).
  2. ContractCase currently is only compatible with Jest (js/ts) and JUnit (java).
  3. 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.

Getting started.

We recommend starting with the getting started guide and following the examples in defining contracts.

For Pact users

ContractCase has a very similar philosophy to Pact, and to maximise Pact compatibility, ContractCase works with the Pact broker. We recommend either:

ContractCase is easier to extend, can express more complex contracts, doesn't restrict where you can use matchers when defining request / response pairs, 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.

  • The Pact Broker for users wanting to host their own broke
  • The excellent Pactflow Broker for those needing SaaS and enterprise features

Internal package versions:

Command line interface::

npm Known Vulnerabilities

Definition DSL packages:

npm Known Vulnerabilities Maven Central

Connector Packages:

npm Known Vulnerabilities

Core Package:

npm Known Vulnerabilities

Roadmap

  1. Pact Parity (complete)
  2. Server driven contracts (complete)
  3. Plugins and arbitrary extensions (complete)
  4. Support java (complete)
  5. Support function-based contracts (complete)
  6. Documentation (in progress)
  7. gRPC matchers
  8. Support Python, C# and Go
  9. Arbitrary combinations of request/response pairs, incidentally including native SQS support
  10. Pass-through APIs

For the gory details of the roadmap, you can see the implementation notebook / todo list here

ContractCase releases follow semantic versioning, with two additional restrictions:

  1. 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.
  2. Before 1.0.0, patch versions will always be backwards compatible.

Breaking changes will always be detailed in the changelog.

About

Next generation contract testing

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Contributors 5