January 2, 2020

303 words 2 mins read

Better API testing with the OpenAPI Specification

Better API testing with the OpenAPI Specification

No one likes it when an API doesnt work as expected. The idea of testing APIs is not a novel concept, but the concept of testing based on a specification is an underexplored space. Taylor Barnett explains how to utilize contract testing with the OpenAPI Specification to create better APIs.

Talk Title Better API testing with the OpenAPI Specification
Speakers Taylor Barnett (Stoplight)
Conference O’Reilly Open Source Convention
Conf Tag Put open source to work
Location Portland, Oregon
Date July 16-19, 2018
URL Talk Page
Slides Talk Slides
Video

If you search on the internet for unexpected API behavior, you’ll soon discover that no one likes when an API doesn’t work as expected. When you take into account the increasing number of APIs and continuous development and delivery of the services built on top of them, it’s no surprise that APIs can move away from their initially expected behavior. This is why expanding API test coverage is critical for success. For years, we have created unit and functional tests for our APIs, but where do we go from there? Taylor Barnett explains how to contract test APIs (i.e, writing tests to ensure that an API or microservice works as described in an agreement) based on a single source of truth—in this case, an OpenAPI Specification document. Contract testing is useful for testing the accuracy of API implementations in server code, SDKs, client libraries, and even third-party APIs, which is especially helpful when other services rely on an API. Taylor details the differences between testing an SDK and the implementation of an API and other use cases and outlines how contract testing can lead to faster development, fewer breaking code changes, and more accurate implementations. Along the way, she shares real-life contract testing examples and techniques to implement within your API projects. Topics include:

comments powered by Disqus