Bi-Directional Contract Testing

This section describes the Bi-directional Contract Testing screens in API Hub for Contract Testing. Bi-Directional Contract Testing is a type of static contract testing where two contracts - one representing consumer expectations, and another representing provider capability - are compared to ensure they are compatible. Refer to the docs for more information on this feature.

The contract details page displays a comprehensive breakdown of the comparison results between a provider contract and its consumer contract (pact), along with metadata, pacticipant information and provider self-verification results.

PF_Screenshot_BiDirectionalContractTesting.png

Statuses

The following table describes the statuses displayed on this page:

Table 2. 

Status

Description

Action Required

The consumer contract is compatible with the provider's contract.

N/A

❗️

The consumer contract is incompatible with the provider's contract, the provider self-verification is unsuccessful, or a classic pact test has failed.

Review the error details to understand the failure cause.

⚠️

No schema comparison has been found for the consumer contract.

Either a consumer contract has yet to be published, or API Hub for Contract Testing has not verified yet. Wait a few minutes and try again (API Hub for Contract Testing generates results in the background), or run a can-i-deploy query for the application in question to force API Hub for Contract Testing to generate a result.



Important

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.

Compatibility Tab

This tab shows any errors and warnings grouped by the affected resource in the OpenAPI document. The grouping is in the form {verb} {path}, for example, get /products/{id}. This is a helpful view if you are more familiar with the OpenAPI Document.

There may be more than one interaction in the consumer contract that is incompatible with a given route.

When provider and consumer contracts are incompatible, warnings, error messages and any mismatches (for Pact verifications) are listed here. You can also find incompatibility messages under interaction items on the Consumer Contract Tab, grouped by the interactions defined in the consumer contract. This is a more helpful view for consumer teams diagnosing problems.

PF_Screenshot_CompatibilityTab.png

For interpreting the errors and warnings displayed on these screens, refer to the compatibility checks guide.

Consumer Contract Tab

Displays the verification result of comparing the consumer contract against the provider contract, from the perspective of the consumer contract.

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

Note

When you perform a classic pact test with Bi-Directional Contract Testing, the classic pact test result displays here.

PF_Screenshot_ConsumerContractTab.png

For interpreting the Bi-Directional Contract Testing related errors and warnings displayed on these screens, refer to the compatibility checks guide.

Provider Contract Tab

This section displays the provider contract, self-verification result and the overall result of comparing the consumer contract against the provider contract, from the perspective of the provider.

PF_Screenshot_ProviderContractTab.png

Provider contracts have two components - the OpenAPI document and the tests that check the API is compatible with the OpenAPI document (the self-verification result).

The status shown in this view indicates whether the OpenAPI document is compatible with the consumer and the self-verification results are successful.

Publication date: