Guide

How to Test Dockerfile and Docker Run Examples in Documentation

Build and run the Dockerfile and docker run examples in your install guides, exactly as written, and record what breaks.

Published
Updated
November 20, 2026
Reading time
9 min
Facts checked against
The Docker build-checks and hadolint documentation, and the live DocsAlive product pages (November 20, 2026)
DocsAlive guide
On this pageThe short answerWhat goes stale in a Dockerfile exampleLint before you buildBuild each Dockerfile from the docsRun each container and check the resultCheck the flags the docs nameKeep secrets out of the testInspect what you builtRun it on every changeChecklist for a Dockerfile example testWhere DocsAlive fitsWhat this does not replaceThe sources we checkedFAQ

Dockerfile examples in docs tend to rot silently. A base image moves, a package is renamed, a flag changes, and the documented build fails for the next reader while the page still looks fine. The fix is to build and run every Dockerfile the docs show, on a clean machine, the same way you would test any other code example.

The short answer

Lint each Dockerfile first, because the cheap static checks catch the mistakes that make builds non-reproducible. Then build it in a clean environment with no cache and no local state to hide behind. Run the container and check the documented result — the health endpoint, the printed output, the listening port — not just the exit code. Compare the built image with what the docs claim about it. And keep the run honest: the build that only works because of a layer cached on the author's machine is exactly the build your reader does not have.

DocsAlive does not replace your Docker tooling. It runs the code samples in your Markdown docs — including the shell blocks around a Dockerfile, the build and run commands a reader copies — in a fresh container per page, and reports the ones that break. The Dockerfile checks on this page stay yours to run; the installation docs guide covers the wider setup path a reader follows before they ever reach a Dockerfile.

What goes stale in a Dockerfile example

  • Base image tags: a floating tag such as python:3 or latest changes under the docs. The same Dockerfile builds a different image this month than last.
  • Package names: system packages get renamed or dropped between base image releases, so an apt-get install line that worked last year fails now.
  • Build flags: flags are added, deprecated and occasionally removed between Docker and Buildx releases.
  • Defaults: the default user, working directory or exposed port changes, and the run instructions in the prose no longer match the image.

A typical stale example combines two of these. The floating tag hides the package change until a reader's build pulls the new base:

FROM python:latest
RUN apt-get update && apt-get install -y libssl1.1
COPY app.py .
CMD python app.py

Nothing in this file is exotic, and every line is a future failure: the tag floats, the package name belongs to one Debian generation, the shell form of CMD changes how signals reach the process, and the versions are unpinned. The lint step below flags most of this before a build is even attempted.

Lint before you build

Start with hadolint, the Dockerfile linter. It reads the file without building it and reports the rules each line breaks:

hadolint Dockerfile

The rules that matter most for documentation examples are the reproducibility ones: DL3006 (always tag the version of an image explicitly), DL3007 (using latest is prone to errors and makes builds non-reproducible), DL3008 (pin versions in apt-get install), DL3013 (pin versions in pip install) and DL3025 (use JSON notation for CMD and ENTRYPOINT). Suppress a rule only with a reason recorded next to the suppression:

hadolint --ignore DL3006 Dockerfile

Docker itself also ships build checks. They were introduced in Dockerfile 1.8 and need Buildx 0.15.0 or later, and they run automatically as warnings during a normal build. To run only the checks — in a docs CI step, for example — use the --check flag, which exits with a non-zero status when a check fails:

docker build --check .

Where a warning should fail the published example outright, promote it with the check directive at the top of the Dockerfile, after the syntax directive:

# syntax=docker/dockerfile:1
# check=error=true

The check names worth knowing for docs work include JSONArgsRecommended, SecretsUsedInArgOrEnv (a secret passed as a build argument or environment variable ends up in the image history), UndefinedVar and CopyIgnoredFile (a COPY source excluded by .dockerignore — a classic reason a build works on the author's machine and fails for a reader who cloned the repo). Lint output belongs in the test record with the file and line, the same as any other docs finding.

Build each Dockerfile from the docs

  1. Copy the Dockerfile exactly as the docs show it, including any files it copies.
  2. Build it in a clean environment, for example docker build --no-cache -t docs-test .
  3. Record the exact failing step and error if the build breaks.
  4. Note any step that only works because of a local cache or a file outside the documented context.

Two flags keep the test honest. --pull fetches the current base image instead of reusing a stale local one, so a moved tag shows up in your run rather than your reader's. --no-cache forces every step to execute, which is slower and is the point: cached layers are where "works on my machine" lives. If the docs rely on a .dockerignore file, include it in the test context exactly as published, and if the docs never mention one, build without it — the reader will.

Multi-stage examples need the full build, not just the first stage. A common docs failure is a final stage that copies from a build stage by a name the example later renamed, or a runtime stage missing a library the build stage had. Build to the final stage, tag that image, and use it for the run test. Record the Docker and Buildx versions with the result: build checks and flag behaviour differ between releases, and a failure report without versions cannot be reproduced.

Run each container and check the result

  1. Run the built image with the exact command the docs give.
  2. Check the documented result: the port answers, the health endpoint returns success, or the printed output matches.
  3. Stop and remove the container after the check.

A container that starts is not a passing test. Check the thing the docs promise. If the guide says the service answers on a port, wait for the port rather than sleeping a fixed number of seconds, and then ask it the documented question:

docker run -d --name docs-test -p 8080:8080 docs-test
curl -sf http://localhost:8080/health
docker rm -f docs-test

If the container exits immediately, read its logs before changing anything: docker logs docs-test shows whether the failure is the image, the documented run command, or the environment the docs forgot to mention — an environment variable, a mounted file, a network the example assumes. Each of those is a different docs fix. Record which one it was; "the example failed" without the layer is a finding nobody can act on.

Check the flags the docs name

Compare the flags in the docs with the installed tool's own help output, for example docker build --help. Removed or renamed flags are a common break, and the help text of the version you test against is the reference — not release notes, and not memory. Where the docs support a range of Docker versions, say which versions the flags were checked against, and prefer flags that exist across the whole supported range.

The same applies inside the Dockerfile. Instruction behaviour changes between Dockerfile versions: the shell and JSON forms of CMD differ in how the process receives signals, which is why the linters push examples toward JSON form, and newer frontend versions add checks and directives that older ones ignore. An example that silently depends on a recent frontend should declare it with the # syntax= directive at the top of the file, so the reader's build uses the same frontend the test used.

Keep secrets out of the test

If a build needs a credential, use a throwaway value scoped to the test. Never bake a real key into the test image, and delete test images that contain one. An image layer keeps everything ever copied into it: deleting a secret in a later layer does not remove it from the earlier one, and docker history shows build arguments to anyone who pulls the image.

Where a build genuinely needs a secret — a private package registry token is the usual case — use a BuildKit secret mount instead of an ARG or ENV:

RUN --mount=type=secret,id=npm_token \
    NPM_TOKEN=$(cat /run/secrets/npm_token) npm install
docker build --secret id=npm_token,env=NPM_TOKEN .

The secret is available during that one build step and is not recorded in the image. If your docs currently show the ARG pattern for credentials, that is a finding in its own right: the SecretsUsedInArgOrEnv build check exists because the pattern leaks, and the documented fix is the mount above.

Inspect what you built

After a passing build and run, compare the image with the claims the docs make about it. docker image inspect docs-test reports the exposed ports, the default command, the environment and the working directory the image actually carries. If the guide says the container listens on 8080 as a non-root user with a health check, the inspect output is where each of those claims is confirmed or contradicted:

docker image inspect docs-test --format '{{json .Config}}'
docker history docs-test

Check the size too. Docs often promise a small final image for multi-stage examples; a final stage that accidentally copies the build toolchain is a docs bug the run test will never catch, because the container still works. docker history shows which layer added the weight, and the fix is usually a copy line that named the wrong source.

Run it on every change

  • Pull requests that touch docs or Dockerfiles: lint, then build and run the affected examples.
  • Releases: build and run every Dockerfile example.
  • Nightly: rebuild with --pull, so base image changes surface even when nobody edited the docs.

A minimal CI outline:

# 1. Static checks
hadolint Dockerfile
docker build --check .

# 2. Honest build
docker build --pull --no-cache -t docs-test .

# 3. Documented result, not just a start
docker run -d --name docs-test -p 8080:8080 docs-test
curl -sf http://localhost:8080/health
docker rm -f docs-test

Record the base image digest each run resolves to, alongside the Docker version. When a nightly build breaks and the Dockerfile has not changed, the digest is the evidence that the base moved — the difference between "our docs broke" and "upstream changed," which have different owners.

Checklist for a Dockerfile example test

Check Evidence to retain
Dockerfile lints clean hadolint output, with any suppression and its reason
Docker build checks pass docker build --check output for the tested version
Clean build succeeds Build log from a --pull --no-cache run, with tool versions
Container produces the documented result The probe used — health response or output — not just an exit code
Flags checked against installed help Tool version the flags were verified against
Image matches the docs' claims Inspect output for ports, user, command and size
No secrets in the image Secret mounts used for credentials; test images deleted
Base image digest recorded Digest resolved by the run, so upstream moves are provable

Where DocsAlive fits

DocsAlive 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 draft the fix for your team to review. For a docs page, that includes the shell sequence around the Dockerfile — the clone, build and run commands a reader copies in order — which is where out-of-date flags, renamed files and missing setup steps actually surface.

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 lint your Dockerfiles, scan your images for vulnerabilities, or replace your image build pipeline. Keep hadolint and the Docker build checks for the file, your scanner for the image, and your own review for whether the prose explains why the example is shaped the way it is. A container that starts also does not prove it is secure, small or production-ready — those are separate reviews with separate tools.

The sources we checked

Source What it covers
Docker build checks documentation The --check flag, the check directive, and the named build checks
hadolint rule reference DL3006, DL3007, DL3008, DL3013 and DL3025 and what each one guards
Docker build documentation BuildKit secret mounts and the --secret flag
Docker CLI reference Build, run, inspect and history flags used in this guide

FAQ

Is a successful build a passing test?

No. A build proves the image assembles. The run test — the documented port, health endpoint or output — proves the image does what the docs say it does. Most stale examples fail at one of the two; you need both to know which.

Why build with --no-cache if it is slower?

Because the cache is the difference between your machine and the reader's. A step that only succeeds from a cached layer fails for every first-time reader. Use the cache in development; drop it in the test that stands in for the reader.

Should docs pin base images to a digest?

Pinning to a digest is the most reproducible option and the hardest to read. A specific version tag is the usual compromise for examples, as long as a nightly --pull build watches the tag for changes. What the linters flag — and readers suffer from — is the floating latest.

Does DocsAlive build my Dockerfiles?

It runs the code samples in your Markdown docs in a fresh container and reports the blocks that break, including the build and run commands shown on the page. Dedicated Dockerfile linting and image scanning stay with your Docker tooling.

How often should Dockerfile examples be rebuilt?

On pull requests that touch them, in full at release, and nightly with --pull — base images change on their own schedule, not yours.

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.