Home / Companies / CircleCI / Blog / Post Details
Content Deep Dive

API contract testing with Joi

Blog post from CircleCI

Post Details
Company
Date Published
Author
Waweru Mwaura
Word Count
2,292
Company Posts That Month
12
Language
English
Hacker News Points
-
Post removed?
No
Summary

Contract testing ensures that different services communicate effectively and adhere to a predetermined set of rules, similar to fulfilling a contract. This tutorial demonstrates using the Joi library to create API contracts for testing an open-source API endpoint that monitors Bitcoin Price Index for various currencies, specifically focusing on testing the responses returned by the Coinbase API using a NodeJS application. By setting up a contract test environment and writing Joi contracts, users can validate API responses against defined schema contracts, identifying errors and inconsistencies. The tutorial also covers automating tests through a CI pipeline configuration using CircleCI, enabling efficient detection of changes in API responses and ensuring the application's reliability against external dependencies. The process involves setting up a NodeJS environment, installing dependencies, creating contract schemas, handling errors, and integrating with CircleCI to automate testing and ensure service stability.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.