# API testing tools: contract, workflow, mock, and performance

The right API testing stack covers four jobs:

- linting the API description
- contract testing the implementation against it
- testing multi-step workflows
- load testing

For contract testing, teams use Pact (consumer-driven) or tools that test against the OpenAPI description, such as Schemathesis, Specmatic, and Redocly Respect.
Prism, Microcks, and the Redocly mock server mock an API from its OpenAPI description, and workflow testing tools like Respect and Step CI run sequences of calls against a live API.

When a refactor drops an optional field that a consumer relies on, automated API tests catch the break before merge.
This guide compares the tools for each kind of test and shows how to wire them into CI.

## Which API testing tool do you need?

Start from the question you need answered, then pick a tool category:

| Question | Approach | Example tools |
| --- | --- | --- |
| Is the API description itself correct and consistent? | Linting and governance | [Redocly CLI `lint`](/docs/cli/commands/lint), Spectral |
| Does the implementation match the contract? | Contract testing | Pact, Schemathesis, Specmatic, Redocly Respect |
| Do multi-step flows, like sign up then order, work end to end? | Workflow testing | Redocly Respect (Arazzo), Step CI, Specmatic, Karate |
| Can consumers build before the API exists? | Mock server | Prism, Microcks, Specmatic stubs, Redocly mock server |
| Does the business logic handle edge cases? | Functional testing | Karate, Postman, code-based test frameworks |
| Does the API hold up under load? | Performance testing | k6 |

## How the testing layers fit together

When each team picks its own testing tools, the organization ends up maintaining overlapping setups that report quality in different ways.
The sections below organize API testing tools by stage, from linting the API description to testing live workflows and load.

### Current trends in API testing

- **Shift-left as standard**: Testing moves into design and development, shortening feedback loops and lowering the cost of fixing bugs.
- **AI-assisted test generation**: Tools generate tests from the API description, and AI assistants turn them into realistic multi-step scenarios.
  For example, the Redocly CLI [`generate-arazzo` command](/docs/cli/commands/generate-arazzo) has a `--with-ai` option.
  Generated tests still need human review.
- **Workflows as a standard format**: The [Arazzo Specification](/learn/arazzo/what-is-arazzo) from the OpenAPI Initiative describes multi-step API workflows.
  Version 1.1, released in May 2026, added AsyncAPI source descriptions, so workflows can mix HTTP and event-driven steps.
- **Drift detection from real traffic**: Besides sending test requests, teams compare recorded production or staging traffic with the API description to find undocumented endpoints and schema mismatches.
- **CLI-first workflows**: Test definitions stored in Git and run from a CLI are easier to wire into CI than tests kept in a separate hosted UI.

```mermaid
graph TB
    subgraph REST["REST APIs"]
        A1[OpenAPI Description] --> A2[Contract Testing]
    end

    subgraph GraphQL["GraphQL APIs"]
        B1[Schema Definition] --> B2[Query Validation]
    end

    subgraph AsyncAPI["Event-Driven APIs"]
        C1[AsyncAPI Description] --> C2[Message Validation]
    end

    D[Modern API Testing Strategy] --> REST
    D --> GraphQL
    D --> AsyncAPI
```

_Diagram: A modern API testing strategy spans REST, GraphQL, and event-driven APIs._

## The shift-left foundation: testing your API's design

The most effective way to improve quality and reduce costs is to shift left: test as early as possible in the software development lifecycle (SDLC).
For APIs, this starts before a single line of code is written.

```mermaid
sequenceDiagram
    participant Design as 📋 Design Phase<br/>$1 to fix
    participant Dev as 💻 Development<br/>$5 to $25 to fix
    participant Test as 🔍 Testing<br/>$50 to $150 to fix
    participant Prod as 🚀 Production<br/>$1000+ to fix

    Design->>Dev: Defect flows downstream
    Dev->>Test: Cost increases dramatically
    Test->>Prod: Cost increases exponentially

    Note over Design: Shift-left catches issues here
    Note over Prod: Emergency patches, downtime costs
```

_Diagram: The cost of fixing defects increases across the lifecycle; shift-left prevents late discovery._

### Shift-left in practice: automated API quality gates in CI/CD

Use the same commands locally and in CI to validate both your API design and its implementation.

```yaml
name: API quality gates
on:
  pull_request:
    branches: [main]

jobs:
  api-validation:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    env:
      API_URL: ${{ vars.API_URL }} # or: ${{ secrets.API_URL }}
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 22

      - name: Lint API description
        run: npx @redocly/cli@latest lint openapi.yaml

      - name: Workflow testing (Arazzo)
        run: npx @redocly/cli@latest respect api-tests.arazzo.yaml --server mainApi=$API_URL
```

In the `--server` option, `mainApi` is the `name` of a source description in the Arazzo file, and the URL replaces the server from the OpenAPI description.

### Prerequisites

- Node.js LTS
- A `redocly.yaml` configuration file in your repository root
- Local: run CLI commands from your repository root
- CI: use the GitHub Actions workflow shown earlier

### Why your OpenAPI description is your most important testing asset

In a design-first workflow, everything starts from the OpenAPI description.
Treat it as the single source of truth for your API's contract.
When the OpenAPI description is an enforceable contract, you can run automated checks during the design phase.

#### Core tool: API linters for contract and style conformance

Start with a configurable API linter, such as the open-source Redocly CLI.
Linting validates the OpenAPI description against a ruleset that can enforce everything from security best practices to naming conventions.
See the [built-in rules](/docs/cli/rules/built-in-rules), [configurable rules](/docs/cli/rules/configurable-rules), and the [`lint` command reference](/docs/cli/commands/lint).

```yaml
apis:
  main:
    root: openapi.yaml
rules:
  operation-2xx-response: error
  operation-operationId-unique: error
  operation-summary: error
  security-defined: error
  rule/path-no-internal-segments:
    subject:
      type: Path
      property: key
    assertions:
      notPattern: "/internal/|/_v1/"
    severity: error
    message: "Path must not contain '/internal/' or '/_v1/' segments"
```

## API contract testing tools

### The problem it solves: preventing integration issues between services

In a microservices architecture, how do you make sure a change to one service doesn't break another?
Contract testing verifies that a consumer and a provider can communicate correctly.
It's faster and less brittle than full end-to-end integration testing because it validates each service in isolation.
For the fundamentals, read [API contract testing 101](/learn/testing/contract-testing-101).

### Contract testing tools compared

The main API contract testing tools differ in where the contract comes from and what they check.
Pact verifies contracts that consumer tests produce.
Schemathesis, Specmatic, Prism, Microcks, and Redocly Respect work from an API description such as OpenAPI.
Dredd worked the same way, but its repository was archived in 2024.
Step CI runs tests you write as YAML workflows.

| Tool | Type | Contract source | Open source | Best for | Keep in mind |
| --- | --- | --- | --- | --- | --- |
| [Pact](https://docs.pact.io/) and PactFlow | Consumer-driven contract testing | Pact files that consumer tests generate | Pact yes; PactFlow is a commercial hosted broker | Independent deployments across many teams, with a "can I deploy?" check | Needs Pact tests on the consumer side and a broker |
| [Schemathesis](https://schemathesis.readthedocs.io/) | Property-based testing from the schema | OpenAPI, GraphQL | Yes | Finding crashes, edge cases, and schema violations automatically | Generated inputs need test data and auth setup to reach deep paths |
| [Specmatic](https://specmatic.io/) | Executable contracts and service virtualization | OpenAPI, AsyncAPI, and other specification formats; runs Arazzo workflows | Open-source core with commercial editions | Contract-driven development with tests and stubs from one specification | Works best when the specification is kept current |
| [Dredd](https://dredd.org/) | Description-based request and response testing | API Blueprint, OpenAPI 2 (OpenAPI 3 experimental) | Yes | Existing suites only | Repository archived in 2024; no longer maintained |
| [Prism](https://stoplight.io/open-source/prism) | Mock server and validation proxy | OpenAPI | Yes | Mocking before the backend exists; validating traffic against the description | A proxy validates the traffic you send through it, not a planned test suite |
| [Microcks](https://microcks.io/) | Mocking and contract testing platform (CNCF project) | OpenAPI, AsyncAPI, gRPC, GraphQL, SOAP, Postman collections | Yes | Mocking and testing many API styles, often on Kubernetes | A platform to run and operate, not just a CLI |
| [Step CI](https://stepci.com/) | YAML-based API test framework | Its own workflows; can generate them from OpenAPI | Yes | Multi-step tests across REST, GraphQL, gRPC, tRPC, and SOAP | Tests use Step CI's own format rather than a standard like Arazzo |
| [Redocly Respect](/docs/respect) | Arazzo workflow runner with OpenAPI validation | Arazzo and OpenAPI | Yes, part of Redocly CLI | Multi-step workflow tests against a live API, with each response checked against the OpenAPI description | Needs a running API server; supports Arazzo 1.0.1 and some Arazzo 1.1 features |

### Tool spotlight: Pact for consumer-driven contracts

In Pact's workflow, consumer-side tests generate a contract file (a pact).
These contracts are published to a central Pact Broker.
The provider's CI pipeline fetches the contracts from the broker and verifies them against the provider codebase.
The broker's key feature is the can-i-deploy status, which tells a team whether they can safely deploy a service without breaking any of its known consumers.

### Tool spotlight: Redocly Respect for OpenAPI-based contracts

Respect takes a complementary approach: the OpenAPI description itself is the contract, so your implementation can't quietly deviate from your design.
Respect runs Arazzo workflows against a live API, passes data between steps, and checks every response against the OpenAPI description: status code, `Content-Type`, and response body schema, plus any success criteria you add.
To learn how to run workflow tests, see the [`respect` command reference](/docs/cli/commands/respect).

```yaml
arazzo: 1.0.1
info:
  title: Test Example API
  version: 1.0.0
sourceDescriptions:
  - name: exampleApi
    type: openapi
    url: openapi.yaml
workflows:
  - workflowId: listAndFetchUser
    steps:
      - stepId: listUsers
        operationId: exampleApi.listUsers
        outputs:
          firstUserId: $response.body#/0/id
      - stepId: fetchUser
        operationId: exampleApi.getUserById
        parameters:
          - name: userId
            in: path
            value: $steps.listUsers.outputs.firstUserId
        successCriteria:
          - condition: $statusCode == 200
```

```bash
# Run the Arazzo workflow, targeting your live API
npx @redocly/cli@latest respect users-test.arazzo.yaml --server exampleApi=https://api.example.com

# With verbose output for debugging
npx @redocly/cli@latest respect users-test.arazzo.yaml --server exampleApi=https://api.staging.example.com --verbose
```

Running multi-step calls with live data catches integration bugs that single-request checks miss.

#### Example: catching a removed field before merge

Before: A provider team merged a refactor that removed an optional field used by a downstream service.
The change slipped past manual tests.

After: A `lint` rule flagged the schema change, and a `respect` workflow failed before merge when the dependent step validated the missing field against the OpenAPI schema.

Impact: The pull request was blocked in under 5 minutes, avoiding a production incident and a half-day rollback.

#### Choose contract testing approaches based on your needs

- **Workflow testing**: You need end-to-end validation of real integration flows, with tests that always reflect the current OpenAPI description.
- **Consumer-driven contracts**: Many consumer teams deploy independently and need to know exactly which fields each consumer uses.
- **Property-based testing**: You want broad input coverage and edge cases found automatically.
- **Test generation from the description**: You need a quick bootstrap and accept managing a generated artifact.
- **Validation proxy**: You need inline validation in a specific environment and can operate a proxy.

## API workflow testing tools

An API workflow testing tool runs a sequence of API calls, passes data from one response into the next request, and checks each step, so you can test journeys like "create a user, log in, place an order" instead of single endpoints.
[Redocly Respect](/docs/respect) runs workflows written in the Arazzo standard and checks every response against the OpenAPI description.
Other options include Step CI (YAML workflows), Specmatic (which can run Arazzo workflows), Karate (code-based scenarios), and Postman collections run in sequence.

Arazzo workflows have an advantage: they're a vendor-neutral standard from the OpenAPI Initiative, so the same file works as documentation, as a test, and as input for other [Arazzo tools](/learn/arazzo/arazzo-tools).
To see a complete example, read [How to test API workflows with Arazzo](/learn/arazzo/testing-arazzo-workflows).

## OpenAPI mock server tools

An OpenAPI mock server reads your API description and returns example responses for each operation, so frontend teams, partners, and tests can call the API before the backend exists.
Common choices are [Prism](https://stoplight.io/open-source/prism) (open-source CLI), [Microcks](https://microcks.io/) (a platform for many API styles), Specmatic stubs, and the [Redocly mock server](/docs/platform/content/api-docs/configure-mock-server), which is hosted with your API documentation.

| Tool | How it runs | Best for |
| --- | --- | --- |
| Prism | Local CLI or container: `prism mock openapi.yaml` | Local development and CI, plus a validation proxy mode |
| Microcks | Self-hosted platform, often on Kubernetes | Mocking OpenAPI, AsyncAPI, gRPC, GraphQL, and SOAP APIs in one place |
| Specmatic | CLI stubs from the same specification it tests against | Teams that already use Specmatic for contract tests |
| Redocly mock server | Hosted, enabled by default for each API description in a Redocly project at `/_mock/<path-to-description>/` (Pro, Scale, and Enterprise plans) | Letting documentation readers send requests from Replay, cURL, or any API client without a backend |

A mock server proves that consumers can work with the contract.
It doesn't prove that the real API keeps it, so pair mocks with contract tests against the real implementation.
The Arazzo examples on this site run against a Redocly mock server, as in the [Arazzo walkthrough](/learn/arazzo/arazzo-walkthrough).

## Tools for functional and request/response testing

Once your API design is sound and the contracts between services are solid, verify that the API implements the required business logic.

### GUI-based tools (for example, Postman)

GUI clients work well for API exploration and manual testing.
GUIs lower the barrier to entry, so people who don't write code can contribute to testing.

### Code-based frameworks (for example, Karate)

For automated functional testing, frameworks like Karate let you write full test suites in code.
They support reusable code, data-driven testing, and parallel execution, which makes them a good fit for maintainable suites at scale.

#### Choose functional testing approaches based on your needs

- **GUI-based**: You need exploratory testing, demos, or collaborative manual checks.
- **Code-based**: You need repeatable, versioned tests in CI with code reuse and data-driven scenarios.

## Tools for performance and load testing

An API that works but is slow can be as much of a problem as one that is broken.
Performance testing measures latency, throughput, and error rates under load.

### Open-source option (for example, k6)

`k6` is developer-focused and integrates into CI/CD pipelines.
Define service-level objectives (SLOs) directly in the test script to automate performance checks.

#### Choose performance testing based on your needs

- You need to validate scalability and latency budgets before production.
- You maintain SLOs/SLIs and want automated gates for regressions.
- You already have contract and functional tests and want to add load testing.

## Quick decision guide

- Validate design quality early?
  Use Redocly CLI `lint` with a governance ruleset.
- Prevent breaking changes between services?
  Use contract tests: `respect` workflows against the OpenAPI description, or Pact for consumer-driven contracts.
- Find edge cases the team didn't think of?
  Use property-based testing, such as Schemathesis.
- Unblock consumers before the API exists?
  Use an OpenAPI mock server.
- Validate business logic and edge cases?
  Use code-based functional tests.
- Explore APIs manually or for demos?
  Use a GUI client.
- Validate scalability and latency budgets?
  Use `k6` in CI.

### Comparison matrix: approaches at a glance

Scan the following table to choose an approach, then read that approach's section for details.

| Approach | Setup effort | Drift risk | CI integration | Skill profile | Best fit | Not a fit |
| --- | --- | --- | --- | --- | --- | --- |
| Workflow testing (`respect`) | Medium (author Arazzo, or generate a starter file) | Low (tests tied to OpenAPI) | First-class via CLI | Developer or technical writer comfortable with YAML | End-to-end contract validation and integrations | One-off manual checks |
| Consumer-driven contracts (Pact) | Medium to high (consumer tests and a broker) | Low | First-class, with can-i-deploy checks | Developers on both consumer and provider teams | Many independently deployed services | Public APIs with unknown consumers |
| Property-based testing (Schemathesis) | Low to medium | Low (generated from the schema) | First-class via CLI | Developer or SDET | Edge cases and schema violations | Business-specific scenarios |
| Test generation (collections) | Low initial, higher ongoing | Medium/High (generated artifact) | Via runners, extra plumbing | Mixed (GUI + scripts) | Bootstrapping quick checks or demos | Long-term regression suites |
| Validation proxy (Prism, `redocly proxy`) | Medium (operate proxy) | Low | Env-specific | DevOps/Platform | In-environment validation where proxying is acceptable | Highly locked-down networks |
| Functional (code-based) | Medium | Low | First-class in CI | SDET/Developer | Complex business logic and data-driven tests | Non-technical teams |
| GUI manual | Low | N/A | Limited | Any | Exploration and ad-hoc validation | Scalable automation |
| Performance (`k6`) | Medium | N/A | First-class in CI | Developer/Perf Eng | Load, stress, and soak coverage | Unit-level checks |

## How to evaluate API testing tools

Compare tools on four criteria: how much they overlap with tools you already run, how well they work together, what they cost to maintain, and how easily developers can run them from Git and CI.

### Where Redocly fits

- Lifecycle: Design (OpenAPI) → lint → bundle/split → live contract validation (Respect) → publish docs, all from the same description.
- Workflow: Everything runs from the CLI, in Git and in CI.
- Contract enforcement: Enforce API design rules with `lint`, validate live responses against the OpenAPI description with Respect, and schedule production runs with [Respect Monitoring](/docs/platform/project/respect-monitoring) (Enterprise plan).

```mermaid
sequenceDiagram
    participant Dev as Developer
    participant Spec as OpenAPI Description
    participant Respect as Respect
    participant API as Live API

    Dev->>Spec: Update schema
    Respect->>API: Send real requests
    API-->>Respect: Live responses
    Respect->>Respect: Validate vs updated OpenAPI
    Note over Respect: ✓ Always current, no drift
```

## What to measure after adoption

- PR rejection rate due to contract violations

    - Why: Confirms guardrails catch breaking changes before merge; expect an early spike, then stabilization as teams adapt
    - How: PRs failing `respect`/`lint` checks ÷ total PRs; source: CI checks or GitHub/GitLab APIs
    - Target: Stabilize under an agreed threshold after a few sprints
- % of APIs lint-clean on primary branches

    - Why: Leading indicator of design quality and governance coverage
    - How: Repos passing `@redocly/cli lint` with 0 errors ÷ total active API repos
    - Target: Upward trend quarter-over-quarter (for example, 80% → 95%)
- Incidents related to API contract drift

    - Why: Measures escaped defects that impact consumers
    - How: Incidents tagged with provider/consumer mismatch as root cause
    - Target: Decreasing trend toward zero
- MTTR for API incidents

    - Why: Faster recovery reflects clearer contracts and reproducible tests
    - How: Time from incident start to mitigation/restore in your incident system
    - Target: Decreasing release-over-release
- Performance SLO adherence across releases

    - Why: Ensures APIs remain reliable under load, not just correct
    - How: % of `k6` CI runs meeting latency/throughput/error thresholds
    - Target: ≥ 99% adherence

## Next steps

- Generate a starter Arazzo workflow from your OpenAPI description with the [`generate-arazzo` command](/docs/cli/commands/generate-arazzo).
- Run it with `npx @redocly/cli@latest respect`.
  See the [`respect` command reference](/docs/cli/commands/respect) and [Get started with Respect](/docs/respect/get-started).
- Learn the fundamentals in [API contract testing 101](/learn/testing/contract-testing-101).
- See which tools support the workflow standard in [Arazzo specification tools](/learn/arazzo/arazzo-tools).
