Guide

How to Test Ansible Playbook Examples in Documentation

Syntax-check and lint the playbook examples in your docs, dry-run them, and run them against a throwaway target — before readers copy them onto real machines.

Published
Updated
November 21, 2026
Reading time
10 min
Facts checked against
The Ansible documentation, the Ansible Lint documentation and the Molecule documentation, and the live DocsAlive product pages (November 21, 2026)
DocsAlive guide
On this pageThe short answerWhat goes stale in Ansible docsExtract the examples firstSyntax-check and list the tasksLint the examplesDry-run with check modeRun it against a throwaway targetTest the copies in your guidesKeep credentials out of the runRun it on every changeChecklist for an Ansible example testWhere DocsAlive fitsWhat this does not replaceThe sources we checkedFAQ

Docs for infrastructure tools often show Ansible playbooks: an install guide ends with one, a configuration walkthrough is built around one. Modules get renamed, arguments change, collections move, and a playbook that worked last year fails today — usually on a reader's real machine, mid-install. This guide covers the checks that catch that without touching a live server: syntax-check and lint every documented playbook, dry-run it, and then run it for real against a throwaway target.

The short answer

Test an Ansible example in layers, in the order the layers get more expensive. Extract every playbook, inventory and variables file from the docs exactly as printed. Syntax-check each playbook and list its tasks, which proves the file parses and every module it names resolves. Lint the set, which catches the style and naming problems that turn into real failures at upgrade time. Dry-run with check mode against a test inventory to see what the playbook would change. Then run it for real — in a clean container or a disposable VM — because a dry run is a simulation and some tasks can only be judged by running them. Finally, test the copies: the same playbook usually appears in the install guide, the README and a blog post, and each copy ages on its own.

DocsAlive does not parse or lint Ansible content. It reads the pages around the playbooks — the guides and tutorials where the same examples appear as code blocks — and runs those blocks in a fresh container. Keep the Ansible tooling described here for the playbooks themselves, and use an execution check for the pages readers copy from. The GitHub Actions testing guide covers wiring checks like these into CI, and the documentation drift guide covers why the copies drift apart.

What goes stale in Ansible docs

Ansible content ages in predictable places:

  • Module names and arguments. A module moved into a collection and now needs its fully qualified name, or an argument was renamed, deprecated or removed. The playbook reads fine and fails at the task that names it.
  • Collections and roles. A documented requirements.yml entry points at a version that no longer exists, or a role the playbook includes was renamed on Galaxy.
  • Variables. A variable the playbook needs is not defined in the documented example — it was defined in the author's own inventory, so the example only ever worked on their machine.
  • Inventories and host names. The prose tells the reader to run against a group the example inventory never defines.
  • Expected output. Sample task output that no longer matches what the current Ansible prints, so readers cannot tell a successful run from a failed one.

Every one of these is visible to a check that costs seconds. The expensive way to find them is a reader, on a production-adjacent machine, following your install guide.

Extract the examples first

The checks below work on files, so the first job is getting every documented example into files, unchanged: each playbook as its own .yml, plus the inventory, group variables and requirements.yml the prose assumes. Keep the page each example came from in the filename or a manifest, so a failure points at the page to fix.

Do not complete the examples as you extract them. Docs playbooks are often fragments — three tasks lifted out of a longer file — and a fragment cannot be syntax-checked as a playbook. That is itself a finding about the page: if the reader cannot run it as printed, the page should say it is a fragment and show where it belongs, or be completed until it runs. Extract what is printed, test what is printed, and fix the page — never quietly fix the test copy, or the suite passes while the docs still fail.

Syntax-check and list the tasks

The cheapest real check is the one Ansible ships. --syntax-check parses the playbook and reports syntax errors without running anything or connecting to a host:

ansible-playbook site.yml --syntax-check
ansible-playbook site.yml --list-tasks
ansible-playbook site.yml --list-hosts

--list-tasks shows the tasks the playbook would run, in order, which proves two things the syntax check alone does not: every role and include the playbook references was found, and the task list matches what the prose says the playbook does. --list-hosts shows which hosts the plays would touch, which catches the inventory mismatch above — a play aimed at a group the documented inventory does not define lists no hosts at all. Run all three against the documented inventory, not your own: the reader only has the documented one.

These checks are fast and need no target machines, so there is no excuse for them to be rarer than every docs change. They will not catch a wrong argument value or a module that moved — that is what lint and the runs below are for.

Lint the examples

Ansible Lint is the command-line tool for linting playbooks, roles and collections, and it catches the class of problem that parses fine today and breaks at the next upgrade:

pip install ansible-lint
ansible-lint site.yml

The rules that matter most for docs examples are the naming ones. The fqcn rule asks for fully qualified collection names — ansible.builtin.copy, not copy — which is exactly the rename that breaks old examples when modules move into collections. name[missing] requires every task to carry a name, which is what makes the sample output in your prose match a real run. no-changed-when flags command and shell tasks that never say when they change something — the tasks that report "changed" on every run and teach readers to ignore the recap.

Lint the examples as their own project, with the lint configuration committed beside them. If a rule genuinely does not apply to a teaching example, skip that one rule in the config with a comment saying why — a blanket skip list trains everyone to ignore the linter, including when it finds the real break.

Dry-run with check mode

Check mode is Ansible's dry run. With --check, Ansible makes no changes on the target hosts: modules that support check mode report what they would change, and --diff alongside it shows the file changes that would result:

ansible-playbook site.yml -i inventory.ini --check --diff

Know its limits, because the official documentation states them plainly: check mode cannot scan all possible resource types and is only a simulation. A module that does not support check mode is skipped, so a playbook can dry-run clean and still fail for real at the skipped task. The command and shell modules are the common case — Ansible cannot predict what an arbitrary command will do, so in check mode they are skipped unless the task gives them creates or removes to predict from. Tasks later in the playbook may also behave differently in a dry run, because an earlier task that a later one depends on never actually ran.

Used with those limits in mind, check mode is the right middle layer: it proves the playbook connects, gathers facts, evaluates its conditions and reaches the end, and its diff output is the fastest way to see whether the changes match the prose. It is a preview, not a proof — which is why there is one more layer.

Run it against a throwaway target

The only complete test of a playbook is a run. Give it a target that cannot matter: a clean container or a disposable VM, built from the same operating system the docs name, with nothing on it the run could damage. Run the documented playbook, with the documented inventory and variables, from the beginning, as a reader would. Then run it a second time. A playbook that changes things on the second run is not idempotent, and readers will run it twice — the second run is where undocumented assumptions surface.

For roles and collections, this layer has a dedicated tool. Molecule is the test framework for Ansible content: molecule test runs the full sequence — create the instance, converge it with the role, run the role again to prove idempotence, verify the result, and destroy the instance. If your docs ship a role, its examples belong in a Molecule scenario, and the idempotence step alone catches the missing changed_when class of problem that lint can only warn about.

Compare the run's recap and key task output with the expected output printed in the docs. When they disagree, one of them is wrong, and it is usually the docs.

Test the copies in your guides

A playbook rarely lives in one place. The install guide shows the full file, the quickstart shows the first three tasks, the README shows a shortened version with different variables, and a launch post froze another copy in time. A module rename breaks all of them, but a fix usually lands in one.

Extract from every page, not just the canonical one — the extraction step does not care which page a block came from. When a copy fails, fix the page and search the rest of the docs for the same task text before you call it done. The README testing guide covers the copy that readers meet first and maintainers re-check last.

Keep credentials out of the run

Infrastructure examples attract real secrets like no other docs genre: vault passwords, cloud keys, become passwords, all helpfully illustrated. Three rules keep the test lane safe. First, the syntax, lint and check-mode layers need no real credentials — run them in the plainest CI job you have. Second, the real run uses a throwaway target with throwaway credentials, created for the test and destroyed with it; a playbook that needs a production credential to test is a playbook whose example is wrong for docs. Third, scan the examples themselves: if a documented playbook contains a real-looking password, token or private key, that is a finding about the page, and it should fail the run like any other error.

Run it on every change

  • Pull requests: syntax-check, list tasks and lint on every change to the docs or the examples. All three are fast and need no targets.
  • Releases: add the check-mode run and the full throwaway-target run, against the Ansible and collection versions the release notes name, before the docs are announced.
  • Nightly: run the full set even when nobody touched the docs. Collections release on their own schedule, and the nightly run is what catches a documented requirements.yml entry the day it stops resolving.

Pin the Ansible version in the test job and record it with the results. "The example fails" means one thing on the version your docs claim to support and something else entirely on a version nobody promised — the run should say which it used.

Checklist for an Ansible example test

  • Every playbook, inventory, variables file and requirements file extracted from the docs, unchanged, with its source page recorded.
  • --syntax-check passes on every documented playbook.
  • --list-tasks output matches the tasks the prose describes; --list-hosts matches the documented inventory.
  • Ansible Lint passes, with any skipped rules named in the config with a reason.
  • Modules named by their fully qualified collection names.
  • Check-mode run with --diff completes, and its predicted changes match the prose.
  • Full run against a throwaway target passes — twice, with no changes on the second run.
  • Roles and collections covered by a Molecule scenario where they are shipped.
  • Expected output in the docs compared with a real run's output.
  • Copies in quickstarts, READMEs and posts extracted and tested too.
  • No real credentials in any example; test targets use throwaway credentials.

Where DocsAlive fits

The checks above cover the playbooks. They do not cover the pages around them — the install guide whose prose walks through the playbook task by task, the tutorial that builds it up over three pages, the README in every role repository. 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

Testing the examples does not test your infrastructure: whether the playbook configures the service correctly, securely and at scale is a question for your own environment testing, and a playbook can pass every check here and still be the wrong playbook to teach. Lint does not replace a run, and a dry run does not replace a real run on a throwaway target. And none of this checks the prose — a guide can ship perfectly tested playbooks and still explain them badly. What these checks remove is the specific, common failure where the docs hand a reader a playbook that cannot run, and they remove it before the reader's machine does.

The sources we checked

Source What it covers
Ansible documentation The ansible-playbook options: --syntax-check, --list-tasks, --list-hosts, and check mode with --diff, including its stated limits
Ansible Lint documentation What it lints — playbooks, roles and collections — and the fqcn, name and no-changed-when rules
Molecule documentation The molecule test sequence: create, converge, idempotence, verify, destroy
DocsAlive product pages What the health check runs, the GitHub App, and human-approved fix PRs

FAQ

Is a syntax check enough?

No. A syntax check proves the file parses. It does not prove the modules resolve, the variables exist, or the playbook changes what the prose says. Each layer above catches failures the cheaper layers cannot see, and the full run on a throwaway target is the only complete test.

Why not just use check mode?

Because check mode is a simulation by design. Modules without check-mode support are skipped, command and shell tasks cannot be predicted without help, and later tasks may behave differently when earlier ones never ran. Check mode is a strong preview and a weak proof.

Our examples are fragments of a larger playbook. How do we test them?

Either complete them until each one runs as printed — the reader's experience — or assemble the fragments into the full playbook they came from and test that, while making the page say plainly that the blocks are fragments. What does not work is testing a completed version the reader never sees.

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.