Guide

Testing curl and HTTP examples in API docs

Make HTTP errors fail the command, assert status and response fields against a local stub, keep keys out of pages and know what a scan does with curl and http fences.

Published
Updated
November 17, 2026
Reading time
13 min
Facts checked against
the curl manual (--fail, --fail-with-body, --json, --write-out, --retry), curl exit codes, Python http.server, jq and RFC 9110, with every command run on curl 8.14 (November 11, 2026)
Outlined documentation pages with a lime pulse line running out of the stack
On this pageThe short answerWhy curl examples breakClassify blocks before running themBuild a runnable local harnessValidate bodies and response claimsKeep credentials out of documentationBound network failuresHow the engine handles HTTP blocksTriage a failed checkAdd the check to your workflowWhere DocsAlive fitsThe sources we checkedFAQ

The short answer

Test HTTP examples as requests with explicit expectations: validate the body, make the request against a controlled endpoint, check its status and inspect the fields the documentation promises. The most important detail is that curl normally exits successfully even when a server returns 400 or 404. Use --fail-with-body or -f when an HTTP error should fail the command, and test response content separately.

API documentation, READMEs and quickstarts often give readers a curl command as their first working interaction with a service. That command is a compact contract: it names a host, path, method, headers and body, and usually implies a particular response. Each part can drift independently.

DocsAlive can run supported documentation blocks and classify the resulting failures. Its treatment depends on the fence label and the contents of the block. An http fence and a shell block containing curl do not have identical status handling, and a displayed response is not checked against the server’s response. This guide shows a separate local test for the request and response, then explains the engine’s behavior in version 0.6.3.

For the broader API reference workflow, see testing API reference documentation. For examples that require private access, see testing credential-dependent examples.

Why curl examples break

A request can remain syntactically valid while the API contract changes around it. A route can move from one version to another, a path can be renamed, or a host can change. A POST example may still point to a route that now expects another method. A service can add a required field or change the expected shape of an existing one.

Authentication can drift too. A page may still show an old authorization scheme after the service changes it, or it may omit a required header. A command that worked for its author can fail for readers because it depended on a real key from the author’s environment.

The body is another source of failure. JSON with a trailing comma is invalid, and a missing shell quote can prevent the command from reaching curl at all. A valid JSON string can still be sent with the wrong Content-Type, or contain fields the current API rejects. A response sample can become stale even when the request continues to work.

A build of the documentation site will usually render all of these examples. Rendering proves that a fence can be displayed; it does not establish that the request succeeds or that the response shown to a reader is current.

The exit-status trap

By default, curl treats a completed HTTP transfer as successful even when the HTTP status is an error. A command can receive a 404 or 400 and still exit with status zero. A runner that checks only the process exit status will therefore call that broken request green.

--fail-with-body makes curl return exit code 22 for HTTP error responses while retaining the response body. -f, also written --fail, returns exit code 22 without printing the body. The options are mutually exclusive. The curl manual cautions that -f is not fail-safe: authentication responses such as 401 and 407 can slip through. An explicit status check remains useful when the exact status matters. See the curl manual and curl exit-code guide.

--fail-with-body is available in curl 7.76.0 and later. The local harness below uses curl 8.x. It also checks %{http_code} because a successful transfer alone does not establish that a GET returned 200 or a creation request returned 201.

Classify blocks before running them

A fence label tells a renderer how to present a block. It does not always tell a test what the author intended the reader to execute.

Block Suitable treatment What remains to check
Runnable request against a public or sandbox endpoint Execute with a bounded timeout and explicit status expectations Whether the response fields still match the documented contract
Credential-gated request Keep the credential out of the page; run a separate authorized check if available Whether the documented access and permissions are sufficient
Request against fictional api.acme-docs-demo.test Treat the host as an illustration, not a live service Whether the request’s shape is representative
Response sample Keep it separate from the command and compare stable claims in your own test Whether variable fields are described as variable
http message block Parse and send it only when its host and body are intended to be runnable Status, content and the assumptions made by the sender
Fragment or omitted setup Record the prerequisite or make a complete companion example Whether a reader can assemble the full request

A public endpoint is not automatically a safe test target. Choose an operation and dataset that are appropriate for repeated CI runs. A sandbox can give a more representative integration check than a stub, while a stub gives a fast and predictable check of the documented request’s local mechanics.

Build a runnable local harness

The following two files form a small local test. They need Python 3, bash, curl and jq. Save them in the same directory as stub.py and test-curl.sh, then run bash test-curl.sh from that directory.

The server binds only to 127.0.0.1:18765. It supplies the routes used by the test: a widget lookup, widget creation, a private route and a 404 for other paths. It is a test fixture, not evidence that a production service implements the same contract.

# stub.py
import json
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer


class Handler(BaseHTTPRequestHandler):
    def send_json(self, status, value):
        body = json.dumps(value).encode("utf-8")
        self.send_response(status)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(body)))
        self.end_headers()
        self.wfile.write(body)

    def do_GET(self):
        if self.path == "/v1/widgets/w_123":
            self.send_json(200, {"id": "w_123", "name": "demo"})
        elif self.path == "/v1/private":
            self.send_json(401, {"error": "unauthorized"})
        else:
            self.send_json(404, {"error": "not found"})

    def do_POST(self):
        if self.path != "/v1/widgets":
            self.send_json(404, {"error": "not found"})
            return
        try:
            length = int(self.headers.get("Content-Length", "0"))
            value = json.loads(self.rfile.read(length))
            name = value["name"]
        except (ValueError, KeyError, TypeError):
            self.send_json(400, {"error": "invalid JSON"})
            return
        self.send_json(201, {"id": "w_456", "name": name})


if __name__ == "__main__":
    ThreadingHTTPServer(("127.0.0.1", 18765), Handler).serve_forever()
#!/usr/bin/env bash
# test-curl.sh
set -euo pipefail

work_dir=$(mktemp -d)
server_pid=
cleanup() {
  if [[ -n "$server_pid" ]]; then
    kill "$server_pid" 2>/dev/null || true
    wait "$server_pid" 2>/dev/null || true
  fi
  rm -rf "$work_dir"
}
trap cleanup EXIT

python3 stub.py >"$work_dir/server.log" 2>&1 &
server_pid=$!

ready=0
for _ in {1..50}; do
  if curl -sS --fail-with-body --max-time 1 \
    http://127.0.0.1:18765/v1/widgets/w_123 \
    >"$work_dir/ready.json" 2>/dev/null; then
    ready=1
    break
  fi
  if ! kill -0 "$server_pid" 2>/dev/null; then
    cat "$work_dir/server.log" >&2
    exit 1
  fi
  sleep 0.1
done
if [[ "$ready" != 1 ]]; then
  cat "$work_dir/server.log" >&2
  exit 1
fi

status=$(curl -sS --fail-with-body --max-time 5 \
  -o "$work_dir/get.json" -w '%{http_code}' \
  http://127.0.0.1:18765/v1/widgets/w_123)
[[ "$status" == 200 ]]
jq -e '.id == "w_123" and .name == "demo"' \
  "$work_dir/get.json" >/dev/null

body='{"name":"demo"}'
printf '%s\n' "$body" | python3 -m json.tool >/dev/null
status=$(curl -sS --fail-with-body --max-time 5 \
  -o "$work_dir/post.json" -w '%{http_code}' \
  -H 'Content-Type: application/json' \
  -d "$body" http://127.0.0.1:18765/v1/widgets)
[[ "$status" == 201 ]]
jq -e '.id == "w_456" and .name == "demo"' \
  "$work_dir/post.json" >/dev/null

printf '%s\n' 'GET and POST checks passed'

The readiness loop avoids assuming the server is available immediately after it starts. The cleanup trap stops the server and removes temporary files even if a check fails. If the port is already occupied, stop the other service before running the harness; otherwise the test could reach a different process.

The GET check asserts both the exact status and two response fields. The POST check validates the request body with python3 -m json.tool before sending it, then verifies the creation status and returned fields with jq -e. A false jq expression exits non-zero, so the shell stops. The Python server documentation and jq manual describe the tools used here.

In a real repository, keep the commands under test close enough to the documentation that a change to one prompts a review of the other. A copied test can itself drift. Where practical, extract the documented command or share a fixture, while retaining a readable example for the reader.

A broken path and two different reports

The following command is broken for the stub above: /v1/widget is not the creation route. With the server running, it receives a 404, but curl exits zero because the command does not request HTTP failure handling.

curl -sS -X POST -H 'Content-Type: application/json' \
  -d '{"name":"demo"}' http://127.0.0.1:18765/v1/widget

A runner that checks only the curl exit status reports success. A curl or shell fence in DocsAlive also passes in this situation. Add --fail-with-body, and curl exits 22; the engine reports a failure categorized as runtime-error for review. The explicit status and response assertions in the harness also make the mismatch visible when applied to the documented route.

A non-zero result still needs interpretation. A renamed route is a documentation problem if the page promises that route for the tested API version. A temporary outage, an inaccessible sandbox or a missing credential needs a different response. Preserve the status, command and relevant error while avoiding secrets in logs.

Validate bodies and response claims

Single quotes around a literal JSON body are a useful bash pattern because double quotes inside the JSON remain intact. That does not make the JSON valid: a trailing comma or missing value still needs a parser to detect it. Validate the exact body that will be sent, as the harness does, rather than a separately retyped version.

curl also offers --json as a shortcut. It sends the supplied data using the corresponding binary-data behavior and adds JSON Content-Type and Accept headers. It does not validate that the supplied data is JSON. The option was added in curl 7.82.0. If your audience may have an older curl, document the requirement or use the more widely available header and data options.

Keep a response sample in its own block after an introduction such as “Response:”. Decide whether it promises exact values or illustrates a shape. IDs, timestamps and generated tokens often vary; a test can assert stable keys and types while explaining which values a reader should expect to differ.

DocsAlive recognizes an output block introduced this way and skips it. It does not compare that block with the HTTP response. Printed output is compared only for pycon or python-repl sessions. Use your own assertions for HTTP status, JSON fields and any other response contract.

Keep credentials out of documentation

Use a clearly named placeholder environment variable in a published command, and explain where a reader obtains and supplies its value. ACME_API_KEY, Acme SDK and acme-sdk are fictional names in this guide. Never paste a real key into a page, a test fixture or a command transcript.

For a separate integration check, use a sandbox key stored in CI secrets, with the minimum permissions and lifecycle appropriate to that sandbox. Avoid printing the key in failure logs. Record which environment and account the check uses so a failure can be reproduced by an authorized maintainer.

DocsAlive detects common credential placeholders, including $ACME_API_KEY, and skips the block as needing credentials. It does not currently run examples with customer-provided test credentials. A credential-gated example therefore needs a separate authorized test if you need evidence of the complete flow.

Bound network failures

Use --max-time to limit each transfer. A hung request should not hold a documentation check indefinitely. --retry can retry transient failures such as timeouts and selected HTTP statuses; curl’s default is zero retries. Choose a small retry count appropriate to the endpoint and operation, and be careful with operations that create or modify data.

Retries improve resilience to intermittent upstream failures, but they can also conceal a recurring service problem. Keep the final failure visible and distinguish a network incident from a changed documentation contract. The HTTP semantics specification is useful when deciding what a status code means for the operation.

A local stub answers a narrower question: can the documented request be constructed and checked under controlled conditions? A sandbox check answers whether the real integration works in that environment. Use both when the integration matters and the sandbox permits repeatable testing.

How the engine handles HTTP blocks

In engine 0.6.3, fence form changes the plan. Review the report’s status and reason for every important block; a green result alone does not establish response content.

Block form What the engine does in 0.6.3
curl, bash, sh, shell or zsh Runs it as shell. curl’s own exit status controls success, so 400 and 404 can pass without --fail or --fail-with-body.
console or shell-session Runs lines beginning with $; other lines are treated as output and are not compared.
http Parses a supported method, URL, headers and optional body, then sends with curl. A body causes an application/json content type to be added.
http response of 400 or above Fails. 401 and 403 are categorized as needing credentials; other 4xx results need review as runtime-error; 5xx and connection failures are categorized as external network results.
http response in the 2xx range Passes based on the request result; the response body is not compared.
Placeholder credential Skips a shell or curl block as needing a placeholder, categorized needs-credentials.
Recognized output block Skips it as output-block; its contents are not validated.
Network-requiring block with --no-network Skips it as network disabled, including blocks containing HTTP URLs.
Unmapped fence label Reports pass without running or parsing it; this is a known limitation.

An http fence accepts GET, POST, PUT, PATCH, DELETE, HEAD and OPTIONS request lines, optionally followed by HTTP/1.1. It reads headers until a blank line and treats the remainder as a body. A relative path paired with a Host header is sent over HTTPS, so that form cannot represent a plain HTTP-only local server in this engine. The default per-block timeout is 60 seconds.

The engine’s status categories help separate evidence from a decision. A failed 404 in a shell block with --fail is a review item, not automatically a filed documentation bug. Inspect the report and reproduce against the intended version before changing the page.

Triage a failed check

Finding Investigate Possible action
404 on a documented route API version, host and path Update the route or restore the intended compatibility
400 on a body JSON syntax, required fields and content type Correct the body and add a focused assertion
401 or 403 Auth scheme, permissions and sandbox credential Correct the instructions or repair the authorized test setup
5xx, timeout or name resolution failure Service health and network availability Retry under the agreed policy and investigate the environment
Status passes but a jq assertion fails Changed response field or stale sample Decide which contract is intended and update the responsible side
Placeholder or fictional host Whether the page labels the example clearly Keep it illustrative and add a separately runnable fixture if needed
Output block skipped Whether a reader relies on its values Add a separate response assertion

A useful finding includes the page, line, tested API version, expected result and observed status. Redact credentials and sensitive response data. For the product’s categories and report fields, see findings.

Add the check to your workflow

Run the local harness on changes to the relevant examples and server contract. Run a sandbox check on a schedule and around releases if the sandbox is stable enough for that purpose. A release check should identify the API version and environment it exercised; a local stub alone cannot prove a deployed service is compatible.

Use the following checklist in a review:

[ ] Classify each request, response sample and message block.
[ ] State the API version, host and prerequisites.
[ ] Use --fail-with-body or -f when HTTP errors should fail curl.
[ ] Check the exact expected status where it matters.
[ ] Validate the request JSON before sending it.
[ ] Check stable response fields with a separate assertion.
[ ] Label fictional hosts and illustrative values.
[ ] Keep real credentials in an appropriate secret store.
[ ] Bound transfers and choose a deliberate retry policy.
[ ] Review skipped blocks and external failures.
[ ] Re-run against the intended release or sandbox.

Where DocsAlive fits

DocsAlive extracts supported blocks, plans their treatment and runs executable examples in page order. It reports skips and categorizes failures so maintainers can distinguish likely documentation bugs from credential requirements, external failures and missing context. Its CLI can scan a local checkout or Git URL; execution must be requested with --execute.

Use its report to locate requests worth investigating, then retain a dedicated HTTP test for exact status and response assertions. A scan without execution is an extraction and planning pass. A scan with --no-network cannot verify URL-based requests. For a wider review of coverage, use the documentation testing checklist.

If your API examples live in a framework site, the guides to Starlight and Nextra explain how source layout and tabs affect coverage.

The sources we checked

These sources were read on November 11, 2026.

Source What it covers
curl manual Failure options, JSON shortcut, status output, timeouts and retries
curl exit codes How curl reports transfer failures
Python http.server The local server used in the harness
jq manual JSON assertions and exit status
HTTP semantics HTTP methods and status semantics

FAQ

Why can a curl command pass on a 404?

curl normally reports a successful transfer even when the server returns an HTTP error. Use --fail-with-body or -f when that response should fail the command, and check the exact status separately when it matters.

Does --json validate the request body?

No. It supplies data and JSON headers as a shortcut, but it does not parse the data as JSON. Validate the body separately before sending it.

Does DocsAlive compare an HTTP response with the sample?

No. A recognized response block is skipped as output, and its contents are not compared. Use a separate test to assert the status and stable response fields.

Can I test an example that needs a real key?

Use an authorized sandbox check with a key stored in CI secrets. DocsAlive classifies credential-dependent examples and does not currently run them with customer-provided test credentials.

What does an http fence check?

The engine sends the parsed request and treats responses of 400 or above as failures. It does not compare the response body with a displayed sample, and its relative-path form uses HTTPS with the Host header.

Is a local stub enough?

A stub is useful for repeatable checks of request construction and assertions. It does not establish that a deployed API or its authentication works, so use an authorized integration check for those claims.

Keep reading
Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs testing for API-first companies

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs testing for CLI and developer-tool vendors

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing README Code Examples: Install, Usage and CI

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Python Docs Testing: Doctest, Pytest and Markdown

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

JavaScript Docs Testing: Node, TypeScript and Modules

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Go documentation examples

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

MkDocs Docs Testing: Code Examples, Tabs and Snippets

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing migration guides and changelog examples

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs Testing Checklist: Code Examples Before Release

A practical pre-release checklist for testing documentation examples, reviewing gaps and verifying published packages.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing VitePress documentation examples

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

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.

Outlined documentation pages with a lime pulse line running out of the stackGuide

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.