-
Notifications
You must be signed in to change notification settings - Fork 6
Article - tools for api testing 2025 #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b46f5e9
learn/testing: add Tools for API Testing in 2025 article; update side…
b86284d
learn/testing: refine lead-in, add decision guides and comparison mat…
f3cbbbd
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams 625d90b
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams fbdef21
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams 5a792b4
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams 4099573
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams 31ab785
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams b0c3981
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams 73d6cac
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams d23da64
learn/testing: address PR review comments - fix defect cost figures, …
fa7acba
Update learn/testing/tools-for-api-testing-in-2025.md
themattwilliams 995ee60
Merge branch 'main' into mw-article-tools-for-api-testing-2025
themattwilliams b410f4e
learn/testing: address final PR review comments - code block titles, …
419a092
Merge branch 'main' into mw-article-tools-for-api-testing-2025
themattwilliams 00dba29
learn/testing: remove duplicate contract-approaches table; keep broad…
527c58b
learn/testing: add lead-in sentence before comparison matrix for smoo…
ef0f0f0
learn/testing: fix Next steps links to relative markdown paths; rewri…
3cb85bf
learn/testing: update anchor text to be descriptive and use relative …
574728a
Merge branch 'main' into mw-article-tools-for-api-testing-2025
themattwilliams f32cfa7
Merge branch 'main' into mw-article-tools-for-api-testing-2025
themattwilliams File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| - page: index.md | ||
| - page: contract-testing-101.md | ||
| - page: contract-testing-101.md | ||
| - page: tools-for-api-testing-in-2025.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,321 @@ | ||
| # Tools for API Testing in 2025 | ||
|
|
||
| Have you seen something like this? A code refactor accidentally drops an ‘optional’ field and production errors light up both computers and cortisol for whomever is on duty. A thoughtful API testing process can help to stop the unwanted excitement before merge. | ||
|
|
||
| > What this covers: A practical guide to API testing tools and approaches | ||
| > | ||
| > Why it matters: When done right, teams can reduce risk from breaking changes and improve delivery velocity with a coherent, developer-friendly stack | ||
| > | ||
| > What you'll learn: How to compare contract testing vs functional testing, choose the right tools, and add automated quality gates in CI/CD | ||
| > | ||
| > What you'll take away: A clear(er) decision path, starter config examples, and concrete next steps to run your first workflow test | ||
|
|
||
| Let's jump in! | ||
|
|
||
| ## Beyond just a list — let's think about a framework for your API testing stack | ||
|
|
||
| Is your organization struggling with the chaos of inconsistent API testing tools? When every team chooses its own solution, the result is often a mix of redundant, overlapping tools that create friction, produce inconsistent quality signals, and make it impossible to standardize best practices. | ||
|
|
||
| This guide provides a path out of that chaos. Instead of just another flat list of tools, it offers a strategic framework for evaluating and building a coherent testing stack. We walk through the layers of a modern API testing strategy, from validating the design contract to ensuring production reliability, so you can empower your teams with a paved road for quality. | ||
|
|
||
| ### Four trends reshaping API testing in 2025 | ||
|
|
||
| * **Shift-left as standard**: Testing moves into design and development, shrinking feedback loops and cost-to-fix. | ||
| * **AI/ML-assisted testing**: Automated test generation from specs, self-healing tests, and intelligent prioritization help teams scale quality. | ||
| * **Architectural fragmentation**: GraphQL and event-driven systems (AsyncAPI) demand schema-first validation and workflow-level testing, not just single request/response checks. | ||
| * **Developer Experience (DX)**: Git-friendly, CLI-first, docs-as-code workflows outperform platform-centric approaches for sustainable automation. | ||
|
|
||
| ```mermaid | ||
| graph TB | ||
| subgraph REST["REST APIs"] | ||
| A1[OpenAPI Spec] --> A2[Contract Testing] | ||
| end | ||
|
|
||
| subgraph GraphQL["GraphQL APIs"] | ||
| B1[Schema Definition] --> B2[Query Validation] | ||
| end | ||
|
|
||
| subgraph AsyncAPI["Event-Driven APIs"] | ||
| C1[AsyncAPI Spec] --> C2[Message Validation] | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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—integrating testing 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/>$10 to fix | ||
| participant Test as 🔍 Testing<br/>$50 to fix | ||
| participant Prod as 🚀 Production<br/>$100+ to fix | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Design->>Dev: Defect flows downstream | ||
| Dev->>Test: Cost increases 5x | ||
| Test->>Prod: Cost doubles again | ||
|
|
||
| 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 | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # .github/workflows/api-quality.yml | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| name: API Quality Gates | ||
| on: [pull_request] | ||
| jobs: | ||
| api-validation: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Lint API Spec | ||
| run: npx @redocly/cli lint openapi.yaml | ||
| - name: Workflow Testing | ||
| run: npx @redocly/cli respect api-tests.arazzo.yaml --server mainApi=${{ env.API_URL }} | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js 18+ | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Install Redocly CLI: `npm i -g @redocly/cli` (or run via `npx @redocly/cli <command>`) | ||
| - Place `.redocly.yaml` in your repository root | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Local: run CLI commands from your repo root; CI: use the GitHub Actions workflow shown above | ||
|
|
||
| ### Why your OpenAPI definition is your most important testing asset | ||
|
|
||
| The foundation of a modern, design-first API workflow is the OpenAPI definition. Treat it as the canonical, machine-readable single source of truth for your API. By treating the OpenAPI definition as an enforceable contract, you can automate quality checks at the earliest possible moment: the design phase. | ||
|
|
||
| #### Core tool: API linters for contract and style conformance | ||
|
|
||
| Start with a configurable API linter, with Spectral (via Redocly CLI) as the de facto open-source standard. See the built‑in rules and configurable rules in the CLI docs at [/docs/cli/rules/built-in-rules](/docs/cli/rules/built-in-rules) and the `lint` command at [/docs/cli/commands/lint](/docs/cli/commands/lint). Linting validates the OpenAPI definition against a ruleset that can enforce everything from security best practices to semantic naming conventions. | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # .redocly.yaml | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| apis: | ||
| main: openapi.yaml | ||
| rules: | ||
| operation-2xx-response: error | ||
| operation-operationId-unique: error | ||
| operation-summary: error | ||
| rule/path-no-internal-segments: | ||
| subject: | ||
| type: Path | ||
| property: key | ||
| assertions: | ||
| notPattern: | ||
| pattern: "/internal/|/_v1/" | ||
| message: "Path must not contain '/internal/' or '/_v1/' segments" | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| severity: error | ||
| security-defined: error | ||
| ``` | ||
|
|
||
| ## Tools for contract testing | ||
|
|
||
| ### The problem it solves: preventing integration issues between services | ||
|
|
||
| In a microservices architecture, how do you ensure a change to one service doesn't break another? Contract testing verifies that two services (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. | ||
|
|
||
| ### Tool spotlight: Open source options (e.g., Pact) | ||
|
|
||
| One common tool for consumer-driven contract testing is Pact. In this workflow, consumer-side tests generate a contract file (a pact). These contracts are then published to a central Pact Broker. The provider's CI pipeline fetches these contracts from the broker and verifies them against the provider codebase. The broker's key feature is providing the can-i-deploy status, which tells a team if they can safely deploy a service without breaking any of its known consumers, enabling true independent deployments. | ||
|
|
||
| Redocly's Respect offers an alternative, provider-driven approach where the OpenAPI definition itself serves as the contract, ensuring that your implementation never deviates from your design. Learn how to run workflow tests with the `respect` command at [/docs/cli/commands/respect](/docs/cli/commands/respect). | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #### Respect contract testing in action | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| # users-test.arazzo.yaml | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 | ||
| source: exampleApi | ||
| operationId: listUsers | ||
| onSuccess: | ||
| - id: firstUserId | ||
| from: body.0.id | ||
| - stepId: fetchUser | ||
| source: exampleApi | ||
| operationId: getUserById | ||
| parameters: | ||
| - name: userId | ||
| in: path | ||
| value: $steps.listUsers.outputs.firstUserId | ||
| onSuccess: | ||
| - statusCode: | ||
| equals: 200 | ||
| ``` | ||
|
|
||
| ```bash | ||
| # Run the Arazzo workflow, targeting your live API | ||
| npx @redocly/cli respect users-test.arazzo.yaml --server exampleApi=https://api.example.com | ||
|
|
||
| # With verbose output for debugging | ||
| npx @redocly/cli respect users-test.arazzo.yaml --server exampleApi=https://api.staging.com --verbose | ||
| ``` | ||
|
|
||
| Workflow testing executes real multi-step workflows, passing data between API calls and validating responses against your OpenAPI schemas. This catches integration issues that single-request testing misses, ensuring your API works correctly end-to-end. | ||
|
|
||
| #### Aha moment: a real-world save | ||
|
|
||
| Here's a scenario where the right process and toolings can make a significant difference in outcomes: | ||
|
|
||
| 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 pre‑merge when the dependent step validated the missing field against the OpenAPI schema. | ||
|
|
||
| Impact: The PR was blocked in under 5 minutes, avoiding a production incident and a half‑day rollback effort. | ||
|
|
||
| What changed: The team codified the contract and validated real integration flows automatically on every PR. | ||
|
|
||
| #### Workflow testing vs. test generation vs. proxy: what's the difference? | ||
|
|
||
| | Approach | Example tool | How it works | Key trade-off | | ||
| | :--- | :--- | :--- | :--- | | ||
| | Workflow testing | Respect | Execute Arazzo workflows that reference OpenAPI specs for multi-step API validation | Tests real integration flows; requires Arazzo workflow creation | | ||
| | Test generation from spec | Postman Contract Test Generator | Generate collections that assert contract compliance | Separate artifact can drift without regeneration | | ||
| | Validation proxy | Stoplight Prism | Proxy validates traffic matches the contract | Operational overhead to run/manage proxy | | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #### Choose this if… | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - Respect workflow testing: You need end‑to‑end validation of real integration flows and want tests that always reflect the current OpenAPI. | ||
| - Test generation from spec: You need a quick bootstrap for manual/GUI validation and accept managing a generated artifact. | ||
| - Validation proxy: You need inline validation in a specific environment and can operate a proxy. | ||
|
|
||
| ## Tools for functional and request/response testing | ||
|
|
||
| Once you've confirmed your API design is sound and the contracts between services are solid, verify that the API correctly implements the required business logic. | ||
|
|
||
| ### GUI-based tools (e.g., Postman) | ||
|
|
||
| Great for API exploration and manual testing. GUIs lower the barrier to entry, allowing non-programmers to contribute to testing. | ||
|
|
||
| ### Code-based frameworks (e.g., Karate) | ||
|
|
||
| For automated testing, code-based frameworks like Karate provide comprehensive functionality. They support reusable code, data-driven testing, and parallel execution for reduced execution times—ideal for building maintainable suites at scale. | ||
|
|
||
| #### Choose this if… | ||
|
|
||
| - 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 is functional but slow can be as problematic as one that is broken. Performance testing ensures reliability and scalability. | ||
|
|
||
| ### Open source option (e.g., k6) | ||
|
|
||
| `k6` is developer‑focused and integrates into CI/CD pipelines. Define performance service‑level objectives (SLOs) directly in the test script to codify and automate performance requirements. | ||
|
|
||
| #### Choose this if… | ||
|
|
||
| - You need to validate scalability and latency budgets before production. | ||
| - You maintain SLOs/SLIs and want automated gates for regressions. | ||
| - You already have contract/functional coverage and need performance coverage to complete the picture. | ||
|
|
||
| ### Quick decision guide | ||
|
|
||
| - Validate design quality early? Use CLI `lint` with a governance ruleset. | ||
| - Prevent breaking changes between services? Use `respect` workflow testing. | ||
| - 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 | ||
|
|
||
| | Approach | Setup effort | Drift risk | CI integration | Skill profile | Best fit | Not a fit | | ||
| | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | ||
| | Workflow testing (`respect`) | Medium (author Arazzo) | Low (tests tied to OpenAPI) | First‑class via CLI | Developer/Tech Writer comfortable with YAML | End‑to‑end contract validation and integrations | One‑off manual checks | | ||
| | 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 | Medium (operate proxy) | Low | Env‑specific | DevOps/Platform | In‑env 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 | | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| ## The architect's POV: choosing tools through a four‑pillar framework | ||
|
|
||
| Evaluate tooling across product overlap, workflow cohesion, total cost of ownership, and developer experience. We advocate for favoring integrated, CLI-first workflows that align with docs-as-code and Git-based processes. | ||
|
|
||
| ### Redocly: integrated, not monolithic | ||
|
|
||
| * Lifecycle integration: Design (OpenAPI) → lint → bundle/split → live contract validation (Respect) → publish docs, all spec-first. | ||
| * Developer-centric workflow: CLI-first, Git- and CI-native. | ||
| * Governance and contractual integrity: Enforce API design standards with lint; prevent drift with live validation against the spec. | ||
|
|
||
| ```mermaid | ||
| sequenceDiagram | ||
| participant Dev as Developer | ||
| participant Spec as OpenAPI Spec | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 spec | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Note over Respect: ✓ Always current, no drift | ||
| ``` | ||
|
|
||
| ## Build a coherent, developer‑friendly testing stack | ||
|
|
||
| It's important to assemble a coherent, automated stack that provides the right feedback at the right stage of the development lifecycle. Codify quality gates—start with linting the OpenAPI spec, verify integrations with contract tests, and enforce SLOs with performance tests. | ||
|
|
||
| ### What to measure after adoption | ||
|
|
||
| - PR rejection rate due to contract violations | ||
| - Why: Confirms guardrails catch breaking changes pre‑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 (e.g., 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 | ||
|
|
||
| * Add a Spectral ruleset to your repo and integrate `npx @redocly/cli lint` in CI. See [/docs/cli/rules/built-in-rules](/docs/cli/rules/built-in-rules) and the `lint` command at [/docs/cli/commands/lint](/docs/cli/commands/lint). | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * Create a small Arazzo workflow and run it with `npx @redocly/cli respect`. See the command reference at [/docs/cli/commands/respect](/docs/cli/commands/respect) and the tutorial at [/learn/arazzo/testing-arazzo-workflows](/learn/arazzo/testing-arazzo-workflows). | ||
| * Generate a starter Arazzo workflow with the CLI: see [`generate-arazzo`](/docs/cli/commands/generate-arazzo). | ||
| * Learn the fundamentals: [/learn/testing/contract-testing-101](/learn/testing/contract-testing-101). | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Primary CTA | ||
themattwilliams marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Run your first workflow test with Respect: [/docs/cli/commands/respect](/docs/cli/commands/respect) | ||
|
|
||
|
|
||
themattwilliams marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.