Bi-Directional Contract Testing Workshop

Level: Intermediate

Learn how to implement a Bi-Directional Contract Testing workflow from end-to-end, including integration with your CI/CD system.

Workshop Prerequisites

You must have:

Goals

You will learn how:

  1. To use OpenAPI as part of a contract testing strategy

  2. API testing tools such as Dredd or Postman can be used with PactFlow On-Premises

  3. To publish contracts (such as a pact file or an OpenAPI document) to PactFlow On-Premises

  4. To prevent deploying breaking changes to an environment, such as production

  5. To use existing mocking tools (such as Mountebank or Wiremock) to create a consumer contract

Ways of completing the workshop

  1. See our online katacoda tutorials. The specific bi-directional course that covers the below agenda can be found here.

    • Note

      To complete the workshop, you will need to authenticate to Killercoda (the online learning platform) with GitHub, Google, Twitter or LinkedIn.

  2. You can pick and choose a bi-directional consumer/provider example from our exhaustive list, and you will start by forking the repositories into your own Github account, setting up Github Actions as CI builds, and configuring the projects to point to your own PactFlow On-Premises account. Don't worry, we will take you step by step in the workshop.

Agenda

You will:

  1. Create and document an API using OpenAPI Specification

  2. Write tests for the API using an API testing tool such as RestAssured, Dredd, Postman, and Schemathesis/Swashbuckle. Visit the Examples page for more information.

  3. Publish the provider contract (an OpenAPI document) to PactFlow On-Premises

  4. Deploy the provider to production

  5. Write the API consumer

  6. Write tests for an API client using tools such as Mountebank, Nock, Wiremock, Cypress, and Mock-Service-Worker or traditional Pact .NET to mock the API, and convert those mocks into a consumer contract. Visit the Examples page for more information.

  7. Publish the consumer contract to PactFlow On-Premises

  8. Deploy the consumer to production

  9. Learn about PactFlow On-Premises's breaking change detection system

Tools used

Publication date: