Guide

How to Test GraphQL Examples in Your API Documentation

Validate the operations in your GraphQL docs against the current schema, then run them against a test endpoint — not just one or the other.

Published
Updated
November 21, 2026
Reading time
10 min
Facts checked against
The GraphQL specification and the GraphQL Inspector documentation, and the live DocsAlive product pages (November 21, 2026)
DocsAlive guide
On this pageThe short answerWhat goes stale in GraphQL docsExtract the examples firstGet a current schemaValidate documents against the schemaCatch deprecated usage and breaking changesRun the query, not just the validationTest the copies in your guidesKeep credentials out of the runRun it on every changeChecklist for a GraphQL example testWhere DocsAlive fitsWhat this does not replaceThe sources we checkedFAQ

GraphQL docs are full of queries, mutations and variable blocks. Each one is checked against the schema when a server receives it, so a field that was renamed or removed turns a documented query into an error the reader has to debug. This guide shows how to catch that before readers do: validate every documented operation against the current schema, then run the important ones and compare what comes back with what the docs promise.

The short answer

Test a GraphQL example in layers, because each layer catches a different failure. Extract every query, mutation and fragment from the docs into files a tool can read. Get the current schema, from the SDL file in the repo or by introspection against a test server. Validate the documents against that schema — the same validation a server runs before execution — and fail the run on any error, including use of deprecated fields. Then, for the examples readers actually build on, execute the operation against a test endpoint and compare the shape of the response with the sample response printed in the docs. Finally, test the copies: the same query usually lives in a quickstart, a tutorial and an SDK README as well as the API reference, and each copy drifts on its own schedule.

DocsAlive does not validate GraphQL documents against a schema. It reads the Markdown pages around the API — the guides, tutorials and READMEs where the same operations appear as code blocks — and runs those blocks in a fresh container. Keep the schema tooling described here for the schema itself, and use an execution check for the pages readers 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.

What goes stale in GraphQL docs

GraphQL schemas evolve in small steps, and each step can break a different part of the docs:

  • Renamed or removed fields. The docs query a field the schema no longer has. This is the most common break, and validation catches it immediately.
  • Changed argument types. A variable that was a String is now an ID, an optional argument became required, or an argument was removed. The query text still reads fine; it fails when it is checked against the schema or when its variables are coerced.
  • Deprecated usage. A documented query still works but relies on fields marked deprecated. It will break at the next schema cleanup, and readers are learning a pattern you are about to remove.
  • Sample responses. The JSON shown under a query no longer matches the shape the query returns — fields were renamed, nested differently, or a list became a connection with edges and nodes.
  • Fragment drift. A fragment defined in one guide is reused by name in another, and the two copies no longer agree, so an operation that validates in one page fails in the other.

None of these need a reader to find them. Every one is visible to a validator or a test run, which is the point of testing the examples instead of proofreading them.

Extract the examples first

Validation tools work on documents, so the first job is getting every documented operation into a file, unchanged. Pull each query, mutation, subscription and fragment out of the docs into its own .graphql file, keeping the operation name and the page it came from in the filename or a manifest. Keep fragments with the operations that use them, or in a shared folder every operation is validated with — an operation that spreads a fragment cannot be validated without the fragment's definition.

Do not tidy the examples as you extract them. If a documented query is missing a closing brace or uses a field that does not exist, that is the finding. Extraction that silently fixes the text produces a test suite that passes and docs that still fail for readers. Extract mechanically, validate what you extracted, and fix the docs — not the test copies — when something fails.

Get a current schema

Validation is only as good as the schema it runs against, and a stale schema is worse than none: it passes examples the live API rejects and fails examples the live API accepts. There are two reliable sources. The first is the schema definition in the API's own repository, as an SDL file or printed from the running code — use the version from the same branch the docs describe. The second is introspection: a GraphQL server can describe its own type system in response to an introspection query, so a test or staging endpoint can hand you exactly the schema it enforces.

Whichever source you use, record where the schema came from and when. When a validation run fails, the first question is whether the docs are wrong or the schema snapshot is old, and a run that cannot answer that question gets ignored. Refresh the schema in the same job that runs the validation, never as a manual step someone has to remember.

Validate documents against the schema

A GraphQL server parses each operation and then validates it against the type system before running it — the specification's Validation section describes this step, and a document that fails validation is not executed. You can run the same step offline, against every documented example, long before a reader does. GraphQL Inspector is one tool built for exactly this: its validate command takes the documents first and the schema second, checks the documents against the schema, and also reports use of deprecated fields:

npm install -g @graphql-inspector/cli
graphql-inspector validate './documents/*.graphql' schema.graphql

Run it so that any error fails the job, and print the file and the operation name with each failure. A validation error that scrolls past in a log is a broken example waiting for a reader. The failures you will see most are the stale cases above: fields that do not exist on a type, variables of the wrong type, required arguments that are missing, and fragments that are defined twice or not at all.

Validation proves an operation is well formed against the schema. It does not prove the operation does what the surrounding prose says it does, and it says nothing about the response. That is what the next two layers are for.

Catch deprecated usage and breaking changes

Two schema-side checks keep the docs ahead of the schema instead of behind it. The first is deprecated usage: because validate reports documents that rely on deprecated fields, a docs page that teaches a deprecated field fails the run while the field still works — which is when you want to know, not after the removal ships. Treat deprecated usage in docs as an error, not a warning, or it will still be there at removal time.

The second is the schema diff. When the schema changes, GraphQL Inspector's diff command compares the old and new schemas and marks each change breaking, dangerous or non-breaking:

graphql-inspector diff schema-old.graphql schema-new.graphql

A breaking change on that list — a removed field, a tightened type, a new required argument — is a list of docs pages to check before the release goes out. The same tool's coverage command reports how much of the schema your documents exercise, which shows the other gap: fields and types the API has but the docs never mention. Coverage gaps are not errors, but they are the cheapest map of undocumented surface you can get.

Run the query, not just the validation

Validation proves the operation is well formed. It does not prove it returns what the docs say it returns. Where a test endpoint exists, execute each documented operation with the documented variables and compare the response with the sample printed in the docs. Compare the shape, not the bytes: field names, nesting and types must match, while generated IDs, timestamps and paging cursors will differ between runs and should be masked out of the comparison.

Pay attention to the error cases the docs describe. If a guide says a query returns a specific error when a record does not exist, run that case too — error shapes drift just as data shapes do, and a reader following a troubleshooting page is the reader least able to improvise. Mutations deserve the same treatment as queries, run against a disposable data set: a documented mutation whose arguments changed will often still validate if the new argument is optional, and only an execution shows that it no longer does what the prose claims.

Keep this lane credentialed and separate, as the next section describes. Validation runs anywhere, on every change, with no secrets. Execution needs an endpoint and usually a token, so it runs where those are safe to use.

Test the copies in your guides

The reference is not the only place an operation lives. The quickstart shows the first query a new user runs. The tutorial builds a mutation up over three pages. The SDK README repeats both in a second language's syntax. Each copy was correct when it was pasted, and each one ages independently, so a schema change that the reference survives can still break the tutorial.

Extract and validate the copies the same way as the reference examples — the extraction step above does not care which page a code block came from. When a copy fails, fix the page, and check whether the same operation appears anywhere else. The documentation drift guide covers the general pattern: examples rarely live in one place, and testing only the canonical copy leaves the others to fail in front of readers.

Keep credentials out of the run

Docs examples love realistic tokens, and realistic tokens have a way of being real. Three rules keep the test lane safe. First, the validation lane needs no credentials at all — schema and documents are both files — so run it in the plainest CI job you have, with no secrets in the environment. Second, the execution lane uses a dedicated test account on a test endpoint, with a token stored in the CI secret store and scoped to that environment; a token copied from a developer's machine, or worse from the docs themselves, is a leak with extra steps. Third, scan the examples before you run them: if a documented query ships with a token, an email address or a production URL in it, that is a finding about the docs, and it should fail the run like any other error.

Run it on every change

  • Pull requests: validate on every change to the docs or the schema. Validation is fast and needs no endpoint, so there is no reason for it to be rarer than the lint you already run.
  • Releases: run the full set — validation, the schema diff against the previous release, and execution against the release candidate — before the new schema is announced, so the docs and the API change in the same step.
  • Nightly: run validation and execution against the live schema even when nobody touched the docs. Schemas change under docs that nobody edited, and the nightly run is what catches drift from the API side.

Whichever cadence you choose, the failure has to reach a person. A failing docs test that only colours a dashboard red will be failing, unread, on the day a reader finds the same break by hand.

Checklist for a GraphQL example test

  • Every query, mutation and fragment extracted from the docs, unchanged, with its source page recorded.
  • Schema taken from the current branch or by introspection, refreshed in the same job that validates.
  • Validation run over all documents; any error fails the job and names the file and operation.
  • Deprecated field usage treated as an error, not a warning.
  • Schema diff checked on every schema change; breaking changes matched against the docs before release.
  • Key operations executed against a test endpoint; response shape compared with the documented sample, volatile values masked.
  • Documented error cases executed, not just the happy path.
  • Copies in quickstarts, tutorials and READMEs extracted and validated too.
  • No real credentials in any example, and the execution lane uses a scoped test token.

Where DocsAlive fits

The checks above cover the schema and the reference. They do not cover the pages around them — the quickstart whose first query is the one every new user runs, the tutorial whose mutation spans three pages, the README in each SDK repo. Those pages are Markdown, and their code blocks are where readers actually copy from. DocsAlive runs the code samples in your docs in a clean sandbox and reports what breaks: it installs DocsAlive as a GitHub App, runs the blocks, and opens fix PRs that a human approves. A free health check runs the samples on up to 40 pages of a public repo and sends a report within 2 business days — the quickest way to see where the copies in your guides stand. The docs testing checklist puts this execution layer next to the rest of the pre-release checks.

What this does not replace

Schema validation does not test the API itself: resolvers, permissions and performance belong to the API's own test suite, and an operation can validate, execute and still be the wrong operation to teach. Execution testing of examples does not replace contract testing between services. And none of this checks the prose — a guide can have perfectly valid examples and still explain them badly. What these checks remove is the specific, common failure where the docs show an operation the schema no longer accepts, and they remove it before a reader finds it.

The sources we checked

Source What it covers
GraphQL specification The validation step: documents are checked against the type system before execution
GraphQL Inspector documentation and README The validate, diff and coverage commands, their argument order, and deprecated-usage reporting
DocsAlive product pages What the health check runs, the GitHub App, and human-approved fix PRs

FAQ

Is a valid operation enough?

No. Validation means the operation agrees with the schema. It can still return a different shape from the sample response in the docs, rely on a deprecated field, or be the wrong example for the task the page describes. Validation, deprecated-usage checks and an execution run answer those separate questions.

My docs generate the reference from the schema. Do I still need this?

The generated reference inherits the schema's correctness, but the handwritten pages around it — quickstarts, tutorials, migration guides — do not, and generated references still ship sample responses and example operations that can go stale. Test the handwritten copies at minimum.

Should sample responses be compared byte for byte?

Usually not. IDs, timestamps and cursors change between runs. Compare status, field names, nesting and types, mask the volatile values, and treat any field the docs promise but the response omits as a failure.

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.