Templates

Baseline contract tests

Start contract testing every operation in your spec with one rule.

contractschemastarter

What it does

Adds contract tests to every operation: a 2xx status, the documented content type, a JSON body and a response that matches the JSON schema in your spec. It is the same set Portman applies when you run it without a config file, so it is the natural starting point to customise.

portman-config.json
{  "version": 1,  "tests": {    "contractTests": [      {        "openApiOperation": "*::/*",        "statusSuccess": {          "enabled": true        },        "contentType": {          "enabled": true        },        "jsonBody": {          "enabled": true        },        "schemaValidation": {          "enabled": true        }      }    ]  }}

Run it

terminal
$ npx @apideck/portman -l ./openapi.yaml -c ./portman-config.json -b http://localhost:3050 -n true

Notes

  • The wildcard target "*::/*" matches every method on every path.
  • Drop -n true to only generate the collection without running it.