Scale API Test Automation with Contract Testing of OpenAPI Specs

Julian Vargas
Julian Vargas

When software engineering teams embark on an API-first development and microservices journey, they can face the challenge of "runaway test case complexity" almost immediately. This is because adding just three microservices on top of 50 existing microservices can create hundreds of new ways that APIs can interact. And yet many leading digital companies thrive with hundreds and even thousands of microservices. Their secret? Reduce risk as early as possible with contract testing of OpenAPI specs during API design and development. 

But as microservices continue to scale in the name of innovating CX, can contract testing create a false sense of confidence? 

In this workshop Julian will discuss the benefits of contract testing as the first part of a continuous testing workflow that encompasses the entire development lifecycle. With this “high visibility” approach, testing teams can capture contract issues as early as the design phase and then quickly prioritize and debug them. 

You’ll learn how OpenAPI specs (standardized API contracts) can be used to mock APIs and then generate contract tests for immediate validations of both API consumers and producers. You’ll also learn how to validate the contract itself and get clear insight into what’s causing an error detected by contract testing, which is particularly useful if the contract is handled by multiple teams and/or contractors who may make changes with little or no domain knowledge. 

Finally, while contract testing can replace some functional and integration testing, many critical validations require more sophisticated functional, integration, and load testing. Vargas will walk through how to extend contract tests into API functional tests that can be reused as integration and load tests or uptime monitors. In this way, API testing reports, dashboards, and feedback loops become highly usable by any stakeholder across the whole development lifecycle.

 

Learning Outcomes

  • Make contract testing (with automated updating) a critical first step in a full-SDLC approach to continuous testing with enhanced visibility and fast debugging
  • Use mocking (from OpenAPI specs) to validate API consumer and publisher contracts
  • Extend contract tests with functional assertions to reduce false positives