Skip to main content

Bi-Directional Contract Testing

A Bi-Directional Contract Testing is a test that compares your provider contract (eg. an OpenAPI/Swagger document) and your consumer contract (pact).

This section contains information about the Bi-Directional Contract Testing UI on Pactflow.

Overview tab

Bi-Directional Contract Testing results are listed one the overview tab.

Bi-directional Contract Test Overview Screen

StatusDescription
successThe consumer contract is compatible with provider's contract.
failedThe consumer contract is incompatible with provider's contract, or provider self verification is unsuccessful, or a classic pact test is failed along with a bi-directional contract test
unverifiedNo schema comparison has been found for the consumer contract.
we are working hard to improve this view even further.

Currently this page supports showing one verification per consumer version, whichever provider version was most recently published will be the verification displayed.

Each verification is still generated behind the scenes though, and will work as expected when using 'can-i-deploy' in your build pipeline or via CLI.

We are still working to improve aspects of the Bi-Directional contract UI, including the 'Matrix' view, which will offer a more complete display of each verification that is available.

You can check our roadmap for progress, or to vote for new items

Bi-Directional Contract Testing Detail Page

Bi-Directional Contract Testing detail page holds detailed schema comparison results between a provider contract versus a consumer contract (pact) along with metadata, participant information and provider self-verification results.

Bi-directional Contract Test Detail Screen

Contract Comparison Tab

An overview of the Bi-Directional Contract Testing.

Consumer Contract Tab

Show verification result of the consumer contract by the provider contract.

Clicking on interaction item toggles interaction detail in relation of the current Bi-Directional Contract Testing.

Note: When a classic pact test is performed along with Bi-Directional Contract Testing, the classic pact test result will be displayed under this tab.

Provider Contract Tab

Show provider contract detail and provider self verification result. Currently, only OpenAPI/Swagger is supported.

Matrix View Tab

Currently the matrix page will only show consumer generated contracts.

Each verification is still generated behind the scenes though, and will work as expected when using 'can-i-deploy' in your build pipeline or via CLI.

We are still working to improve aspects of the Bi-Directional contract UI, including this 'Matrix' view, which will offer a more complete display of each verification that is available.

You can check our roadmap for progress, or to vote for new items

Matrix View Tab

When a pact is published, a comparison will be generated asychronously with the latest provider contract from each branch, and for the provider contract of each deployed/released provider version. When a provider contract is published, a comparsion will be generated asychronously with the latest pact for each branch, and for each deployed/released consumer version. These results will be used to populate the data for the matrix page.

Should a can-i-deploy query be made for a combination of application versions for which a comparsion has not been generated, the comparsion will be performed synchronously, and the results returned in the response.

Contract Incompatibility Messages

When provider and consumer contracts are incompatible, incompatibility messages and mismatches are listed at Contract Comparison Tab. You can also find incompatibility messages under interaction items at Consumer Contract Tab

Error MesssageDescription
Request accept header is incompatiblePact request's accept header content is incompatible with provider contract
Request misses authorization headerPact request's authorization header is missing
Request body is incompatiblePact request's body content is incompatible with provider contract
Request content type header is incompatiblePact request's content type header is incompatible with provider contract
Request header is incompatiblePact request's header content is incompatible with provider contract
Request contains unknown path or methodPact contains unknown request's path or method compared with provider contract
Request query is incompatiblePact request query content is incompatible with provider contract
Response body is incompatiblePact response's body content is incompatible with provider contract
Response body contains unknown informationPact response's body contains unknown content compared with provider contract
Response request is incompatiblePact response's request content is incompatible with provider contract
Response header contains unknown informationPact response's header contains unknown content compared with provider contract