Testing with Speakeasy
INFO
Speakeasy’s testing features are in early access. Breaking changes may occur.
With Speakeasy, you can verify functionality by generating and running tests for both SDKs and APIs. Our solution scales from per-operation SDK tests to end-to-end API tests to validate any multi-step API user journey.
Design philosophy
Just as with our SDK design philosophy, Speakeasy strives to deliver a best-in-class development experience for contract testing. Speakeasy’s contract tests are designed to be:
- Human readable: Speakeasy-generated tests avoid convoluted abstractions and are easy for developers to read and debug.
- Batteries-included: Tests are generated for all SDK operations, with the option to use a real API testing environment. A generated mock API server works out of the box, avoiding complex test environment setups, such as data seeding.
- Rich in coverage: Automatically generated contract tests verify all possible data fields to ensure full coverage. If data examples are not available, realistic example values for the field are used based on name, type, and format information.
- Customizable: Custom tests are supported beside generated tests.
- Minimal dependencies: Speakeasy avoids adding unnecessary dependencies, prioritizing native language libraries and incorporating third-party libraries only when the customer benefits far outweigh the cost of the extra dependency.
- Easy integration: Speakeasy testing easily integrates into your existing API development and testing workflows.
- Open standards: No vendor lock-in necessary.
Features
Speakeasy’s test generation uses the Arazzo Specification to generate tests for your API. Arazzo is a simple, human-readable, and extensible specification for defining API workflows.
Speakeasy’s Arazzo-powered test generation provides the following features:
- Automatically generated contract tests for every operation in your OpenAPI document, including:
- Generating or modifying a
.speakeasy/tests.arazzo.yaml
file to include tests for operations. - Using examples available in your OpenAPI document or autogenerating examples based on the field name, type, and format of your schemas.
- Generating a mock server capable of responding to API requests, making the tests functional.
- Generating or modifying a
- Custom tests and workflows for any use case, with rich testing capabilities, such as:
- Testing multiple operations.
- Testing different inputs.
- Validating the correct response is returned.
- Running tests against a real API or mock server.
- Configuring setup and teardown routines for complex E2E tests.
Prerequisites
To enable testing features, you need the following:
- An existing, successfully generating SDK.
- The Speakeasy CLI or a GitHub repository with Actions enabled.
- Docker (opens in a new tab) or an equivalent container runtime (if using the mock server for local testing).
- An Enterprise or Business tier account.
- Enable the SDK Testing add-on in
settings/billing
under your account.