Skip to main content

Getting started

First off, install the DSL package that's right for your language:

ContractCase works with either Jest or Vitest. Install the package for your test runner:

npm install --save-dev @contract-case/contract-case-jest

# You may also need the peer dependencies:

npm install --save-dev jest@^29.4.3

Contract testing lifecycle​

Here's the lifecycle of a contract test:

  1. Define a contract
    1. Define examples
    2. Run tests to confirm the examples are correct
    3. Upload contracts to a broker
  2. Verify the contract
    1. Download contract from the broker
    2. Verify the contract
    3. Publish verification result to the broker

Next steps​

If you just want to jump in to some examples, you can have a read of:

Jest:

Vitest:

If you're new to contract testing, have a read of what is contract testing.

If you're defining a contract, start here. If you're verifying an existing contract, start here.