Guide

How to Test OpenAPI Documentation Examples

Check the examples inside an OpenAPI spec against their schemas and a running server, not just the schema itself.

Published
Updated
November 20, 2026
Reading time
10 min
Facts checked against
The OpenAPI Specification, the Spectral, Redocly and Prism documentation, and the live DocsAlive product pages (November 20, 2026)
DocsAlive guide
On this pageThe short answerValidate the spec firstCheck examples against their schemasTest the examples against a running serverTest the spec with a mock serverKeep credentials out of the runCatch drift between spec and codeRun it on every changeChecklist for an OpenAPI example testWhere DocsAlive fitsWhat this does not replaceThe sources we checkedFAQ

An OpenAPI spec is often the source of truth for an API reference, but the examples inside it are copied into guides, READMEs and SDK docs too. When a field is renamed in the schema, the spec can still be valid while every example that uses the old field is wrong. This guide covers how to check the examples, not just the schema.

The short answer

Test an OpenAPI document in layers, because each layer catches a different failure. Lint the spec so structural and style problems fail early. Validate every example and examples value against the schema it sits beside, because a spec can parse cleanly while its samples describe fields that no longer exist. Then run the documented requests against a real server, or against a mock built from the spec, and compare what comes back with what the docs promise. Finally, test the copies: examples travel from the spec into Markdown guides and README quickstarts, and those copies drift on their own schedule.

DocsAlive does not parse, lint or validate an OpenAPI document. It reads the Markdown pages around the spec — the guides, tutorials and READMEs where the same examples appear as code blocks — and runs those blocks in a fresh container. Keep the spec tooling described here for the spec itself, and use an execution check for the pages readers actually copy from. The API reference testing guide covers the rendered reference page, and the curl examples guide covers the command-line form of the same requests.

Validate the spec first

Run a linter or validator on the spec before testing any example. A spec that does not parse cannot give useful example results, and a spec with structural errors makes every downstream check harder to read. Two widely used linters are Spectral and Redocly CLI. Spectral needs a ruleset file before it will lint:

npm install -g @stoplight/spectral-cli
echo 'extends: ["spectral:oas"]' > .spectral.yaml
spectral lint openapi.yaml

The spectral:oas ruleset applies Spectral's OpenAPI rules. Extend it with your own rules in the same file when your style guide has requirements the defaults do not cover, and raise the failure threshold in CI so warnings do not scroll past unnoticed:

spectral lint openapi.yaml --ruleset .spectral.yaml --fail-severity warn
redocly lint openapi.yaml

Linting answers a narrow question: is this document well-formed and consistent with the rules we chose? It does not prove the examples are right. A renamed field passes lint as long as the schema and the example are edited in the same commit — and the failure mode this guide is about is the commit that edits only one of them. That is why the next check exists.

Check examples against their schemas

Every example in the document should be a valid instance of the schema it illustrates. Check request examples against the request schema, response examples against the response schema for that status code, and parameter examples against the parameter schema. Spectral's built-in OpenAPI ruleset includes a rule for exactly this — oas3-valid-media-example for OpenAPI 3 media types — so turn it up to an error in your ruleset:

extends: ["spectral:oas"]
rules:
  oas3-valid-media-example: error

The failure this catches is mundane and common. The schema renames a field, and the example keeps the old name:

components:
  schemas:
    Widget:
      type: object
      properties:
        id:
          type: string
        displayName:        # renamed from "name"
          type: string
      examples:
        - id: "w_123"
          name: "Gear"      # stale: no longer a property of Widget

Depending on the tool, an unknown property in an example is an error, a warning, or silently ignored — additionalProperties decides much of that behaviour — so do not rely on defaults. Make the example-validity rule an error and treat its output as a docs bug list, with the file and line of each example recorded.

Version differences matter here. OpenAPI 3.1 aligns the schema language with JSON Schema 2020-12, so a 3.0 idiom such as nullable: true becomes a type array, type: ["string", "null"]. An example that was valid under a 3.0 reading can be invalid under 3.1, and a validator set to the wrong version will either miss it or flag correct examples. Pin the validator to the version the document declares, and re-run the example checks as part of any 3.0-to-3.1 migration rather than after it.

Test the examples against a running server

  1. Start the API in a clean container, from the same commit the docs describe.
  2. Pull each documented request example from the spec or the guide.
  3. Send it to the server and compare the status code and the top-level response fields with the documented response example.
  4. Record any mismatch with the file and line of the example.

For a documented request, the test is a real call. This documented example:

curl -s https://api.example.com/v1/widgets/w_123 \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"

should return the status code the operation documents, with a body whose shape matches the documented response example: the same top-level fields, the same types, and the same nested objects where the docs name them. Do not compare full response bodies unless the API is deterministic. Timestamps, IDs and paging tokens change between runs. Compare shape and the fields the docs promise, and write down which fields you excluded and why, so a reviewer can tell a deliberate exclusion from an oversight.

Test the error examples too. Most specs document at least one error response, and error shapes drift quietly because fewer readers exercise them in public. Send the request that is supposed to produce the documented 404 or 422 and compare the error body's fields with the example. A changed error field breaks client error handling exactly the way a changed success field breaks the happy path.

Test the spec with a mock server

A mock server built from the spec tests the document from the reader's side. Prism, Stoplight's mock server, serves the paths in the document and answers with the examples the spec contains:

npm install -g @stoplight/prism-cli
prism mock openapi.yaml
# serves the documented paths on http://127.0.0.1:4010

Send the documented requests to the mock. If the mock cannot produce the documented response, or rejects a documented request as invalid, the document disagrees with itself — no running API is needed to find that class of bug. Prism also runs as a proxy in front of a real staging API, validating live traffic against the spec:

prism proxy openapi.yaml https://staging.api.example.com --errors

Property-based testing goes one step further. Schemathesis generates test cases from the schemas — boundary values, missing required fields, wrong types — and checks that the server's responses conform to the document. It finds behaviour the hand-written examples never covered. Keep its role straight, though: it tests the API against the spec. It does not test the prose around the spec, and it does not know which examples your guides copied.

Know what each layer proves. The linter proves the document is well-formed. Example validation proves the samples match the schemas. The mock proves the document is self-consistent. The live run proves the document matches the server you ran. None of them proves that the quickstart page a reader lands on still shows the current field names — that copy lives outside the spec, which is the drift problem covered next.

Keep credentials out of the run

Examples often show an Authorization header with a real-looking token. Replace these with a placeholder in the test run, and use a sandbox key only where the test needs a live call. Mark examples that need a paid or production key so a green run does not hide them.

Keep the placeholder obviously a placeholder. A realistic-looking fake token in a published example gets copied into issue reports and, occasionally, into someone else's code as if it were a format example. Use a value a reader cannot mistake for a real credential, keep real sandbox keys in the CI secret store rather than in the repository, and make sure test logs redact the header — a passing run that prints a live key to a public log has created a worse problem than the stale example it was checking.

Catch drift between spec and code

Two checks catch most drift:

  • Spec against code: generate a spec from the running server and diff it with the committed spec. Any field present in one and not the other is drift.
  • Examples against spec: run the validator on examples after every spec change, not only on release.

Add a third check at release time: diff the spec itself between versions and read the breaking changes. oasdiff's breaking command reports the changes that break existing clients between two versions of a document:

oasdiff breaking openapi-v1.yaml openapi-v2.yaml

Every breaking change it reports needs a docs action: an example updated, a migration note written, or a deliberate decision recorded. The documentation drift guide covers the wider pattern, including how a breaking-change list becomes docs tickets.

The copies need their own check. When an example is pasted from the spec into a getting-started guide, the spec's checks stop covering it. The guide now has its own version of the truth, edited on a different schedule. Inventory the places each important example appears — spec, reference page, quickstart, README — and make sure at least one check runs each copy. In practice the Markdown copies are the ones that go stale, because nothing in the spec pipeline ever opens those files.

Run it on every change

  • Pull requests that touch the spec or docs: lint the spec and run the examples against a test server.
  • Releases: run the full example set against the release build.
  • Nightly: run all examples, so upstream changes show up even when nobody edits the docs.

A minimal CI outline, with each layer as its own step so a failure names the layer that caught it:

# 1. Lint the document
spectral lint openapi.yaml --ruleset .spectral.yaml --fail-severity warn

# 2. Serve the spec's own examples and probe them
prism mock openapi.yaml &
curl -s http://127.0.0.1:4010/v1/widgets/w_123

# 3. Run the documented requests against the release build
#    (your contract-test runner, pointed at the staging URL)

# 4. List breaking changes since the last release
oasdiff breaking openapi-prev.yaml openapi.yaml

Keep the results separate. A lint failure, an invalid example and a live-response mismatch have different owners and different fixes, and a single rolled-up green or red hides which one you have. Record the spec revision and the server build with each result so a failure can be reproduced against the same pair later.

Checklist for an OpenAPI example test

Check Evidence to retain
Spec parses and lints clean Linter name, ruleset and revision of the document
Every example validates against its schema Rule output with the file and line of each failing example
Documented requests run against a real build Status codes and compared fields, with exclusions named
Error examples exercised The request used and the error body returned
Mock serves the documented responses Mock log or probe output for the main paths
Breaking changes reviewed oasdiff output and the docs action taken for each change
Copies outside the spec inventoried List of guides and READMEs carrying each key example
Credentials kept out Placeholder values in examples; sandbox keys held in CI secrets

Where DocsAlive fits

DocsAlive covers the layer the spec tools cannot see: the examples as they appear in your Markdown documentation. It runs the code samples in your docs in an isolated container on each release and nightly, separates likely docs bugs from expected failures, and can open a fix PR through its GitHub App for a human to approve. A stale field name in a quickstart's JSON block, or a curl example that now returns a different shape, is the kind of finding it reports with the page and line.

For a starting point, the free health check lets you send a public repository you own or maintain; the team runs the engine on up to 40 of its docs pages and emails the real report within 2 business days; the checkout is deleted after the run. Pricing is Open source $0/month, Team $299/month, Growth $699/month, and Scale from $1,499/month.

What this does not replace

DocsAlive does not parse or lint your OpenAPI document, validate its examples against their schemas, or stand in for a contract test against your API. Keep Spectral or Redocly for the document, a mock or property-based tool for the contract, and your own review for whether the prose explains the API well. A passing example also does not prove the surrounding text is right: descriptions, limits and behaviour notes drift in ways no execution check can see, and they still need a reader.

The sources we checked

Source What it covers
OpenAPI Specification Where examples live in a document and what they must agree with
Spectral documentation and OpenAPI ruleset reference Lint commands, rulesets, and the oas3-valid-media-example rule
Redocly CLI documentation The redocly lint command
Prism documentation Mock and proxy modes, request validation, the default local port
Schemathesis documentation Schema-based test generation and response conformance checks
oasdiff documentation The breaking-changes command used for release diffs

FAQ

Is a valid spec enough?

No. Validity means the document follows the OpenAPI format. Its examples can still name fields the schema dropped, and its operations can still disagree with the running server. Example validation and a live run answer those separate questions.

Should examples be compared byte for byte with live responses?

Usually not. Timestamps, generated IDs and paging tokens change between runs. Compare status codes, field names, types and the fields the docs promise, and record any field you deliberately exclude.

What does a mock server prove?

That the document is self-consistent: the mock serves the spec's own examples and validates requests against the spec, so a document that disagrees with itself fails without any API running. It says nothing about whether the real API matches the document.

Does DocsAlive lint the spec file?

No. It runs the code samples in your Markdown docs — the guides and READMEs where examples are copied — and reports the ones that break. Keep your spec linter and contract tests for the document itself.

How often should example checks run?

On pull requests that touch the spec or the docs, against the release build before a release, and nightly, so dependency and upstream changes surface even in weeks when nobody edits the docs.

Keep reading
DocsAlive guideGuide

Docs Testing: How to Test the Code Samples in Your Docs

Why code examples in documentation break, the ways teams test them (doctest, docs-as-tests, CI runners) and how to run every sample on each release.

Two lenses held over the same documentation page, each bringing a different layer into focusComparison

Vale vs markdownlint: What Each Docs Linter Catches

Vale checks prose style; markdownlint checks Markdown structure. What each catches, sample configs, running both in CI and what neither one tests.

Blueprint of two documentation pages: one with a handwritten test script, one whose code blocks are framed and checkedComparison

Doc Detective vs DocsAlive: Testing the Code in Your Docs

Doc Detective is a free, open-source docs-as-tests framework; DocsAlive is a hosted docs CI for code examples. Features, price, setup and when to use each.

A machine blueprint above a ruled documentation page, with a caliper measuring between themComparison

Promptless Alternative: Promptless vs DocsAlive Compared

Promptless drafts docs updates from what you ship; DocsAlive runs the code examples you've published. Features, pricing, security and when to use each.

A long workbench of outlined testing instruments, each with a small lime light, beside a stack of documentation pagesGuide

Best Free Tools to Test Code Examples in Documentation

Free, open-source tools that run the code examples in your docs: rustdoc, Go examples, doctest, pytest plugins, Sphinx doctest, Doc Detective and byexample.

DocsAlive guideGuide

Testing SDK Docs Before Every Release: A Release-Gate Guide

Test SDK and client-library docs against the package you ship: build the wheel or npm tarball, install it clean, run every example, and gate the release in CI.

DocsAlive guideGuide

How to Test Quickstarts and Tutorials in Your Docs

Test the onboarding path a new reader follows: run quickstarts in a clean environment, in page order, sort real bugs from credentials and fragments, and wire it into CI.

DocsAlive guideGuide

How to Test CLI Documentation: Commands, Flags and Output

Test the commands a CLI page promises: install in a clean container, run examples in order, compare flags with --help, check exit codes and output, and run it in CI.

DocsAlive guideGuide

How to Test API Reference Docs: Requests, Responses and SDKs

Test API reference pages against the contract they publish: methods, parameters, request and response examples, SDK snippets, status codes and OpenAPI samples.

DocsAlive guideGuide

Docs testing for API-first companies

Keep API quickstarts, SDK snippets and curl examples working across releases.

DocsAlive guideGuide

Docs testing for CLI and developer-tool vendors

Test developer-tool install paths, package managers and command examples across releases.

DocsAlive guideGuide

Testing README Code Examples: Install, Usage and CI

Keep README install commands and usage examples working with clean environments, output checks and CI.

DocsAlive guideGuide

Testing Notebooks and Executable Docs: Cells, Kernels and Output

Test notebooks in fresh kernels, check meaningful output and manage dependencies, data and drift in CI.

DocsAlive guideGuide

Testing Docs in GitHub Actions: Pull Requests and Scheduled Checks

Run documentation example checks in GitHub Actions with practical guidance on schedules, path filters, caching, secrets and reports.

DocsAlive guideGuide

Testing Code Examples in MkDocs, Docusaurus and Sphinx Sites

Find and test documentation examples in Markdown, MDX and reStructuredText, alongside site builds and link checks.

DocsAlive guideGuide

Python Docs Testing: Doctest, Pytest and Markdown

Test Python documentation with doctest, pytest, Markdown example execution and isolated environments.

DocsAlive guideGuide

JavaScript Docs Testing: Node, TypeScript and Modules

Test Node and TypeScript documentation examples across module formats, package versions and type checks.

DocsAlive guideGuide

Testing Go documentation examples

Test Go example functions and Markdown snippets against the intended module versions in clean environments.

DocsAlive guideGuide

Sphinx Docs Testing: doctest, code-block and MyST

Test Sphinx documentation examples: what the doctest and linkcheck builders prove, code-block and literalinclude, MyST fences, and what a Markdown scan covers.

DocsAlive guideGuide

ReadMe Docs Testing: CLI, OpenAPI and Code Examples

Test ReadMe documentation examples: docs-as-code and bi-directional sync, what lint and oas:validate prove, Tabs variants and runnable code.

DocsAlive guideGuide

TypeScript Docs Testing: tsc --noEmit and Runtime

Test TypeScript documentation examples: type-check snippets with tsc --noEmit in a consumer project, then run them, and what each check proves.

DocsAlive guideGuide

Docusaurus Docs Testing: Code Blocks, Tabs and MDX

Test Docusaurus documentation examples: builds vs runnable code, code block metadata, Tabs install variants, MDX pages and clean-container runs.

DocsAlive guideGuide

Mintlify Docs Testing: CodeGroup, Tabs and the CLI

Test Mintlify documentation examples: docs.json, MDX pages, CodeGroup and Tabs variants, what mint broken-links and mint validate prove, and clean runs.

DocsAlive guideGuide

MkDocs Docs Testing: Code Examples, Tabs and Snippets

Test MkDocs documentation examples: strict builds, Material tabs, Snippets includes, mkdocstrings pages and clean-container runs.

DocsAlive guideGuide

Testing Installation Instructions: pip, npm and Containers

Test documented install steps in clean environments: pip and extras, venv, npm install vs npm ci, containers and the first import.

DocsAlive guideGuide

AI SDK Docs Testing: LLM Examples, Keys and Drift

Test AI and LLM SDK documentation examples: requests, responses, streaming, tool calls, credentials, model retirements and CI.

DocsAlive guideGuide

Testing migration guides and changelog examples

Test before and after examples against the right releases and make migration documentation part of the release gate.

DocsAlive guideGuide

The Cost of Broken Code Examples in Documentation

Understand how broken documentation examples create friction in developer adoption and support, and how to reduce it.

DocsAlive guideGuide

Testing Rust documentation examples

Test Rust rustdoc examples and cargo documentation tests, and keep native Rust checks because compiled Rust fences are recognized but not executed.

DocsAlive guideGuide

Testing VitePress documentation examples

Test VitePress Markdown examples separately from the site build, including code groups, includes and what a plain Markdown scan covers.

DocsAlive guideGuide

Testing docs in GitLab CI

Run documentation example checks in GitLab CI jobs, keep site builds separate from execution, and review what a scan covers and skips.

DocsAlive guideGuide

Testing JSON, TOML and YAML examples in docs

Test JSON, TOML and YAML config examples in documentation: parse, schema and tool checks, honest fence labels, fragments, CI jobs and what a scan covers.

DocsAlive guideGuide

Testing Java documentation examples

Test Java examples in READMEs, SDK docs and Javadoc: the source launcher, javac, JShell scripts, assertions, @snippet files, CI and what a scan covers.

DocsAlive guideGuide

Testing PHP documentation examples

Test PHP examples in docs: php -l lint, clean-directory runs, assertions with zend.assertions, Composer scratch projects, PHPUnit, CI and scan coverage.

DocsAlive guideGuide

Testing C# documentation examples

Test C# examples in docs: .NET 10 file-based apps, dotnet build with warnings as errors, test projects, XML doc comments, CI and scan coverage.

DocsAlive guideGuide

Testing Ruby documentation examples

Test Ruby examples in docs: ruby -c syntax checks, clean-directory runs, bundler/inline, minitest assertions, YARD examples, CI and scan coverage.

DocsAlive guideGuide

Testing Kotlin documentation examples

Test Kotlin examples in docs: kotlinc runnable JARs and scripts, -Werror, KDoc @sample in compiled source, kotlinx-knit, fence labels, CI and scan coverage.

DocsAlive guideGuide

Testing Swift documentation examples

Test Swift examples in docs: swift scripts, swiftc -typecheck, DocC snippets compiled by swift build, Swift Testing assertions, CI containers and scan coverage.

DocsAlive guideGuide

Testing curl and HTTP examples in API docs

Test curl examples in API docs: --fail-with-body, status and JSON checks against a local stub, http fences, credentials and what a docs scan checks.

DocsAlive guideGuide

Testing Astro Starlight documentation examples

Test code examples in Astro Starlight docs: src/content/docs inventory, Tabs and Expressive Code, Markdoc pages, a Node check script, CI and scan coverage.

DocsAlive guideGuide

Testing Nextra documentation examples

Test code examples in Nextra docs: content/ and app/ sources, fence metadata, Tabs and npm2yarn, a Node check script, CI and an honest scan limitation.

DocsAlive guideGuide

Docs testing for open-source projects

Test the code examples in open-source docs and READMEs: pull requests from forks, release and scheduled checks, contributor guidelines, triage and the Open source plan.

DocsAlive guideGuide

Docs testing for technical writers and docs teams

How technical writers and docs teams test the code examples they publish: docs-as-code checks, style-guide rules, reading a report, routing findings to engineers.

DocsAlive guideGuide

Docs testing for DevRel teams

How developer advocates test quickstarts, tutorials, workshops and sample READMEs: an inventory, a launch and release cadence, reading a report, and honest reporting.

DocsAlive guideGuide

Testing Hugo documentation examples

Test the code examples in Hugo docs: fences with brace options, the highlight shortcode, Docsy tabs, drafts and theme example sites, scan scope and CI.

DocsAlive guideGuide

Testing GitBook documentation examples

Test the code examples in GitBook docs synced to Git: the space root, code tags, tabs, reusable includes, invisible characters, scan scope and CI.

DocsAlive guideGuide

Testing SQL examples in documentation

Test SQL examples in docs: run fences in page order on a fresh database, assert results, handle dialects, SQLite STRICT typing, psql ON_ERROR_STOP and CI.

DocsAlive guideGuide

Testing mdBook documentation examples

Test the code in an mdBook: what mdbook test covers, rust attributes, hidden lines, include directives, untagged output fences and a scan-ready copy for CI.

DocsAlive guideGuide

Testing Docsify documentation examples

Test the code examples in Docsify docs: embedded code files and fragments, docsify-tabs tab sets, Prism grammars, scan scope and a CI check.

DocsAlive guideGuide

Testing Jekyll documentation examples

Test the code examples in Jekyll docs: include tags, site variables, highlight tags, posts and _site copies, a scan-ready copy and Ruby hooks.

DocsAlive guideGuide

Testing Antora and AsciiDoc documentation examples

Test the code examples in Antora docs: example includes, tagged regions, attributes, failing the build on missing includes and a Markdown copy to scan.

DocsAlive guideGuide

Testing Fumadocs documentation examples

Test the code examples in Fumadocs docs: npm fences and package-manager tabs, tab groups, the Tabs component, includes, pycon highlighting and a scan-ready copy.

DocsAlive guideGuide

Testing versioned Docusaurus docs

Test every Docusaurus version readers can reach: versioned_docs copies, versions.json, partials, tabs, per-version scans and old-version triage.

DocsAlive guideGuide

Testing Read the Docs documentation examples

Test the code examples on a Read the Docs site: .readthedocs.yaml build jobs, a pycon gate, latest and stable versions, Sphinx, MyST and .rst coverage.

DocsAlive guideGuide

Testing Eleventy documentation examples

Test the code examples in Eleventy docs: Liquid pre-processing, global data, include tags, ignored drafts, raw tags and a rendered copy to scan.

DocsAlive guideGuide

Testing Zola documentation examples

Test the code examples in Zola docs: Tera content templating, raw tags, config values, hide_lines, drafts, blog posts and a scan-ready copy.

DocsAlive guideGuide

Testing Quarto documentation examples

Test the code examples in Quarto docs: executable cells, display-only fences, freeze and _freeze, a CI profile, cell options and a copy to scan.

DocsAlive guideGuide

Testing Hexo documentation examples

Test the code examples in Hexo docs: posts, drafts, scaffolds, codeblock and include_code tags, a build check and a scan-ready copy.

DocsAlive guideGuide

Testing pdoc documentation examples

Test the code examples in pdoc docs: doctest for >>> sessions, fenced docstring examples, the README, private items and a copy to scan.

DocsAlive guideGuide

Testing Doxygen documentation examples

Test the code examples in Doxygen docs: compiled example files, snippets, Markdown pages, WARN_AS_ERROR and what a scan can and cannot check.

DocsAlive guideGuide

Testing TypeDoc documentation examples

Test the code examples in TypeDoc docs: example tags, includeCode regions, project documents, a compiler check of extracted examples and a scan.

DocsAlive guideGuide

Testing JSDoc documentation examples

Test the code examples in JSDoc docs: example tags, captions, source patterns, tutorials, a doclet export and a scan-ready copy with assertions.

DocsAlive guideGuide

Testing docs examples with pre-commit hooks

Check docs code examples with pre-commit: local hooks, files filters, always_run, pass_filenames, SKIP and --no-verify, and what to leave for CI.

DocsAlive guideGuide

Testing documentation examples with Deno

Run docs code examples with deno test --doc: JSDoc and Markdown examples, imports, hashbang permissions, ignored blocks and deno check --doc-only.

DocsAlive guideGuide

Testing documentation examples with Sybil

Test Python docs examples with Sybil and pytest: Markdown parsers, invisible setup, skips, clear-namespace, docstrings and pycon fences a scan can read.

DocsAlive guideGuide

Testing Markdoc documentation examples

Test the code examples in Markdoc docs: variables in fences, partials, if/else, custom tabs, validate in CI and a scan-ready copy from transform.

DocsAlive guideGuide

Testing Markdown examples with phmdoctest

Test Python examples in README and Markdown files with phmdoctest: sessions, output blocks, directives, --report, generated pytest files and pycon fences.

DocsAlive guideGuide

Testing Markdown code blocks with pytest-markdown-docs

Run Markdown python fences as pytest tests with pytest-markdown-docs: globals hook, fixtures, continuation, notest, retry and pinning the released version.

DocsAlive guideGuide

Testing command line docs with prysk and Cram

Test CLI docs with prysk and Cram: .t transcripts, exit statuses, (re) and (glob) matches, and generating tests from the console blocks in your Markdown.

DocsAlive guideGuide

Testing Python docstring examples with xdoctest

Run docstring examples with xdoctest: the pytest plugin, google and freeform parsing, permissive output matching, directives, and what it does not check.

DocsAlive guideGuide

Testing multi-language docs examples with byexample

Test docs examples with byexample: prompt-based language detection, the -l selection, +pass, +skip and timeouts, capture tags, and hidden setup in comments.

DocsAlive guideGuide

Testing Markdown code blocks with mktestdocs

Run Markdown code blocks under pytest with mktestdocs: exact fence labels, memory=True for shared state, bash blocks, custom executors and docstring checks.

DocsAlive guideGuide

Testing README code blocks with pytest-codeblocks

Run README and Markdown code blocks with pytest-codeblocks: exact python, sh and bash labels, cont, skip and xfail markers, expected output, and gaps.

DocsAlive guideGuide

Testing Markdown code examples in any language with txm

Test annotated Markdown examples with txm: program, in, out, err, check and exit annotations, TAP output, exact matching, and blocks it never runs.

DocsAlive guideGuide

Testing Sphinx docs examples with sphinx.ext.doctest

Run Sphinx doctest, testcode and testoutput directives in reStructuredText or MyST pages: groups, hidden setup, global setup and what is never run.

DocsAlive guideGuide

Testing docs examples that need API keys

Test credential-gated docs examples: honest placeholders, offline stubs and fixtures, live sandbox jobs, CI secrets and fork rules, and how a scan classifies them.

A machine blueprint above a ruled documentation page, with a caliper measuring between themGuide

Documentation Drift: How to Detect It Before Users Do

What documentation drift is, why code examples drift first, and practical ways to detect it: ownership, release checks, link and execution tests.

See which of your code samples still run.

Send us a public repository. Our team runs DocsAlive on its docs and emails you the real report within 2 business days. Free, no signup.