How I test technical tutorials before publishing them

By , engineer and technical writer for devtools

Created on Nov 24, 2026
Categories: Developer education
Tags: technical-writing, tutorials, docker, developer-experience, devtools, developer-adoption

TL;DR: I test technical tutorials by running every step in a fresh, pinned Docker environment, comparing the real output with the output written in the draft, and deliberately breaking the setup to capture the errors a reader will see. Testing happens after each step, not once at the end, so every step is reproducible in order. A tutorial that only passes on the author’s machine isn’t tested.

Most published code never gets run in the conditions it claims to support. The research below explains why so many tutorials quietly fail their readers, and the case study in this article shows it happening to my own published work.

Why do so many published tutorials fail?

A surprising share of code published on the web can’t run as written. Large-scale studies have measured the executability of code samples across different contexts:

StudyWhat was testedResult
Yang, Hussain, and Lopes, MSR 2016About 3 million Stack Overflow code snippets25.61% of Python snippets and 20.00% of JavaScript snippets were runnable; only 1.00% of Java and 0.12% of C# snippets compiled as pasted
Horton and Parnin, ICSME 2018 (“Gistable”)10,259 starred Python gists24.4% executed successfully in a clean Python 2.7 environment; 52.4% died on ImportError alone; Python 3 runs produced fewer successes (1,445) and far more SyntaxErrors
Pimentel et al., MSR 2019863,878 attempted Jupyter notebook executions24.11% executed without errors; 4.03% reproduced the stored results

One caveat: a Stack Overflow snippet is supposed to illustrate an idea, not ship as a complete program, and notebooks encode data and state that tutorials don’t. The studies measure strict executability, which is a harder bar than most snippets are written for. A published tutorial claims exactly that bar. When a page says “run this command and you’ll get this output,” the reader holds it to a runnable standard.

The ecosystem around the tutorial keeps moving after publication. GitHub’s 2017 Open Source Survey of 5,500 participants found 93% of respondents had encountered incomplete or outdated documentation, while 60% of contributors said they rarely or never contribute to documentation. Readers hit the problem constantly; few projects have a process to fix it.

And the audience keeps growing. Stack Overflow’s 2025 developer survey found technical documentation is the most-used resource for learning to code, at nearly 68% of respondents. In the survey’s AI section, 66% of developers report frustration with AI solutions that are “almost right, but not quite.” An untested tutorial is the human-written version of that problem: plausible, complete-looking, and broken at step three.

What does my tutorial testing process look like?

I test after each step while writing, not in a single pass at the end. By the time the draft is done, every step has already run in sequence, so the last re-run is a confirmation rather than a discovery exercise.

The process for a typical tutorial:

  1. Build first. Before writing prose, I complete the workflow myself as a new user would, from account creation or pip install to the finished result. The article describes what actually happened, not what the product docs promised would happen.
  2. Fresh environment. Each test run starts in a clean Docker container with pinned images and pinned dependencies. My development machine has years of packages, environment variables, and half-remembered fixes that hide missing steps.
  3. Test after each step. I run the step’s commands exactly as written in the draft, in the same order a reader would, and only then write the explanation around the observed behavior.
  4. Compare real output. The output shown in the article comes from the actual run, copied after verification. If the draft’s expected output disagrees with the run, the draft is wrong.
  5. Break it on purpose. Wrong credentials, missing environment variables, unavailable services, and unpinned version drift all get tried deliberately. The errors a reader will hit get captured and documented.
  6. Record the test. The tested versions, environment, and date get written down, so a future maintainer knows exactly what passed and when.

The checklist version, with the failure each check exists to catch:

CheckWhat I look forFailure the check catches
Step runs in a clean environmentCommands succeed with no hidden stateSteps that only work on the author’s machine
Output comparisonPrinted results match the article, character by character where fixedStale or invented “expected output”
Order and completenessBlocks work top to bottom with no skipped commandsMissing imports, missing setup, reordered steps
Deliberate breakageError messages are captured, not guessedTroubleshooting advice that names the wrong error
Version pinsEvery install names a version or a tested rangeSilent drift to a breaking major release
Test recordVersions, environment, and date written in the repoNobody knowing whether an old tutorial still works

The reader-facing output of the last step is a test record: a small table or README line stating which versions, images, and platforms were verified on which date. “Tested November 2026: Python 3.12, SQLAlchemy 2.1.9, PostgreSQL 16, Debian bookworm” is a claim a reader can check against their own setup.

How do I set up a clean test environment with Docker?

Docker gives every test run a known starting point. There is no inherited state, no leftover database, and no global package that makes a missing dependency invisible. If the tutorial works in the container, it will work on a fresh laptop, a CI runner, or a colleague’s machine.

For a tutorial that needs PostgreSQL, the compose file looks like this:

services:
  db:
    image: postgres:16
    environment:
      POSTGRES_USER: coderpad
      POSTGRES_DB: coderpad
      POSTGRES_PASSWORD: test-password
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U coderpad -d coderpad"]
      interval: 2s
      timeout: 5s
      retries: 20

  runner:
    image: python:3.12-slim
    depends_on:
      db:
        condition: service_healthy
    volumes:
      - ./scripts:/work
    working_dir: /work
    entrypoint: ["bash", "-c"]

Each step of the tutorial gets its own small script in scripts/. The scripts are the tutorial’s code blocks extracted verbatim. Testing a step looks like:

docker compose up -d db --wait
docker compose run --rm runner "python step_01_connect.py"

If the step succeeds, the draft’s explanation can state the result. If the step fails, the error goes into the findings log before any prose is written. The -v flag on docker compose down -v drops the database volume, so the next run starts from nothing.

My earlier piece on why Docker exists covers the same isolation idea for readers newer to containers. For tutorial testing, the property that matters is repeatability: two runs with nothing changed must produce the same result, and two runs a year apart must tell you what changed.

What happened when I re-tested my own 2023 SQLAlchemy tutorial?

A few years ago I published a tutorial on interacting with PostgreSQL using SQLAlchemy’s ORM. The post was written to run inside a hosted coding sandbox, where the database and dependencies were already in place, and the steps worked there at the time. A lot has changed since: SQLAlchemy moved from 1.4 to the 2.x series, pip resolves different packages today, and readers running the tutorial on their own machines face a different environment than the sandbox the post was written for. In November 2026 I re-ran the steps in the clean Docker setup above: postgres:16, python:3.12-slim, and whatever pip install resolves today, which turned out to be SQLAlchemy 2.1.9.

The tutorial no longer passes on a fresh machine:

Published stepWhat actually happenedThe fix a reader needs
pip install sqlalchemy psycopg2Build failed: Error: pg_config executable not found. psycopg2 builds from source and needs PostgreSQL headers and a compilerInstall psycopg2-binary, or install libpq-dev and gcc first
URL.create(drivername="postgresql", ...)ModuleNotFoundError: No module named 'psycopg'. SQLAlchemy 2.x defaults the postgresql dialect to psycopg 3; the 2023 tutorial targeted SQLAlchemy 1.4, which defaulted to psycopg2Use drivername="postgresql+psycopg2", or install psycopg
host="/tmp/postgresql/socket"Environment-specific: works where the database socket lives in /tmp, fails on a typical machineUse a hostname like localhost or db, plus password and port
author_id = Column(Integer(), ForeignKey('authors.id'))NameError: name 'ForeignKey' is not defined. The import was missing in the published blockAdd ForeignKey to the sqlalchemy import
session.query(Article.slug, Article.title)[2]Returned ('clean-python', 'Cleaner Python'), not the published ('sqlalchemy-postgres', ...). Row order without ORDER BY is unspecified, and an UPDATE reordered the rowsUse ORDER BY before indexing, or query by a filter
order_by(Article.title.desc())The published “expected” order was wrong. Real output: Interacting with Databases using SQLAlchemy with PostgreSQL, How to Get Metadata from PostgreSQL System Catalogs, Cleaner PythonCopy output from the actual run
Email fields in the sample authorsRendered as [email protected] — an email-obfuscation artifact copied from the published pageUse plainly written example addresses like ezz@example.com

Some of the failures are honest mistakes that slipped through in the original post: the missing import and the wrong expected output. Most of the rest are what a few years of ecosystem drift does to an unpinned tutorial. pip install followed SQLAlchemy from 1.4 to 2.x, where the default driver and the Session.query API both changed, and the connection example only made sense inside the environment the post was written for. A version pin and a test record would have told any maintainer exactly what had been verified and when.

The lesson that applies beyond this one post: a tutorial that only passes in the environment it was written for has a short shelf life. The environment a reader runs is the test environment. If steps depend on a specific hosted setup, the page has to say so, and anything readers run on their own machines still needs testing.

This is also why measuring time to first successful API call matters separately from documentation quality: a broken tutorial inflates the first-failure rate, and the analytics can’t tell a product bug from a stale pip install line.

How do I break a tutorial on purpose?

Happy-path testing finds the obvious failures. Deliberate sabotage finds the errors readers will actually paste into a search bar. During the re-test above, I ran the connection code with a wrong password and with a missing environment variable. The captured output:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server
at "db" (172.23.0.2), port 5432 failed: FATAL:  password authentication failed
for user "coderpad"
KeyError: 'DB_PASSWORD'

A troubleshooting section built from guesses says something vague like “check your credentials.” A section built from real breakage can match the exact message:

If you seeIt usually meansWhat to try
pg_config executable not foundpsycopg2 is building from source without PostgreSQL headersUse psycopg2-binary or install libpq-dev and gcc
No module named 'psycopg'SQLAlchemy 2.x resolved postgresql to the psycopg 3 driverPin the driver with postgresql+psycopg2 or install psycopg
password authentication failedWrong password, or credentials from a different environmentRecheck which environment the .env belongs to
connection refused / could not translate host nameDatabase container not ready, or a sandbox path used on a real networkWait on the healthcheck; use a hostname, not a socket path
KeyError: 'DB_PASSWORD'Required environment variable never loadedExport it, or add a .env file the tutorial names

The same technique applies beyond databases: call the API with a revoked key, run the quickstart without the required scope, paste an example with the wrong file path. Each sabotage run takes minutes and produces one concrete troubleshooting row that a real reader will need.

What does testing catch that editing doesn’t?

Editing fixes sentences. Testing fixes steps. The failures in the re-test are invisible to proofreading: a missing ForeignKey import reads fine, an ORDER BY output looks plausible, and psycopg2 is spelled correctly.

Testing also catches what lives outside the article. Missing setup steps and missing permissions are the failures I find most often in client work: a quickstart that works with admin rights but fails with the scope a trial account actually gets, or a guide that assumes an integration the reader has to enable three screens away. No amount of prose review surfaces a missing permission, because the article never claims the permission exists.

A developer platform hired me around the launch of a beta API. I tested the workflow as a new developer and continued until I had a finished working product. During the process, I found API issues and reported the bugs to the team, then wrote the tutorial around the verified path. Reporting a bug and documenting a working route is more useful than polishing instructions around a workflow that fails, and it’s the same approach behind how I think about AEO/GEO for developer tools: an AI answer that quotes a broken tutorial amplifies the breakage.

How do I keep a tutorial working after publication?

Publication is when drift starts. Three practices slow it down:

Pin everything the article depends on. pip install sqlalchemy is a moving target; sqlalchemy==2.1.* or a stated tested range is a claim that can expire visibly instead of silently. The article should name the version in text, not only in a requirements file readers may skip.

Keep a test record. Record the image tags, package versions, OS, and test date next to the tutorial source. A tutorial last verified against SQLAlchemy 1.4 in 2023 tells a different story than one verified against 2.1.9 last week, and the difference belongs on the page.

Re-run on a schedule and on triggers. The same Docker setup used for pre-publish testing works in CI. A scheduled job that recreates the environment, installs the pinned dependencies, and runs the step scripts turns “does this still work?” into a build status:

# Example pattern: a scheduled job that re-runs tutorial steps weekly
on:
  schedule:
    - cron: "0 8 * * 1"
jobs:
  tutorial-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: docker compose up -d db --wait
      - run: docker compose run --rm runner "python step_01_connect.py"
      - run: docker compose run --rm runner "python step_02_schema.py"
      - run: docker compose run --rm runner "python step_03_full_workflow.py"
      - run: docker compose down -v

Change triggers matter more than the calendar: a new major version of the library, a renamed CLI flag, a changed pricing tier, an updated authentication flow, or a deprecated endpoint each mean re-run before the changelog post goes out. When a re-test fails, the fix or the deprecation notice is the update; just bumping the “last updated” date is not.

When is full end-to-end testing not worth it?

Conceptual articles. A piece explaining ORDER BY semantics or why connection pooling exists has illustrative snippets, not a reproducible workflow. The bar is correctness of claims, not executability, though the snippets should still parse.

Approval-gated or expensive environments. Some tutorials need an enterprise contract, manual provisioning, or paid API calls at every run. Test what’s reachable, name the boundary (“verified against the free tier; step 4 requires a paid plan”), and re-test when a test account is available rather than guessing.

Hardware-dependent steps. GPU workloads, specific OS versions, and physical devices can’t all be covered by one clean container. Document which configurations were verified and mark the rest as untested.

When the cost exceeds the audience. A draft read by twelve people inside a private repo doesn’t need a CI harness. A quickstart on a public docs site that feeds onboarding does.

Passing tests also don’t prove the tutorial teaches. Automated runs confirm commands work; they don’t measure whether a new user understands why. A second reader, or the author re-walking the draft cold after a few days, still catches unclear phrasing that a green build can’t.

Can AI tools test or write the tutorial for you?

AI tools can help: extract code blocks from a draft, generate test scripts, diff expected output against real output, and draft troubleshooting rows from captured errors. They’re useful labor inside the process above.

They don’t replace the run. Postman’s 2025 State of the API report reports that 41% of respondents already use AI to generate API documentation. Generated instructions still need execution tests, because a model that writes a plausible psycopg2 install line has no way to know the target image lacks pg_config. An agent with tool access can run the steps, but someone still has to decide what “correct” looks like, verify the claimed output, and own the credential handling.

The 66% “almost right” frustration statistic from Stack Overflow’s 2025 survey describes exactly what happens when generation ships without verification. The tutorial passes or fails in the container, not in the model.

Frequently asked questions

How long should testing a tutorial take?

I don’t have a universal ratio, and I don’t think one exists. Testing after each step spreads the cost across the writing instead of concentrating it at the end, and it shortens the feedback loop: a broken step found at draft time is cheaper than one found in support tickets. The re-test above, including the deliberate breakage runs, took longer than re-reading the post would have. The findings are the argument for spending the time.

What if a tutorial requires a paid API or credentials a tester can’t get?

Test with sandbox keys, trial accounts, and free tiers wherever the product supports them, and write the tutorial around what a new account can actually do. Where a step genuinely can’t be exercised, say so on the page and re-test when access is available. An untested step presented as tested is worse than an honest boundary.

Should every code block in a tutorial be runnable as pasted?

Blocks presented as runnable commands should run as pasted, in order. Fragments used to explain one line, like the ... continuation in a connection example, should be marked as fragments rather than silently failing a reader who runs them. The mismatch that hurts is a partial snippet styled like a complete command.

How often should a published tutorial be re-tested?

On change triggers first: new major versions of every dependency, renamed flags, changed authentication, deprecated endpoints. On a schedule second: a monthly or quarterly CI re-run catches drift nobody announced. The test record on the page tells readers how stale the verification is.

Who should run the tutorial test?

Ideally, not the author, and not on the author’s machine. A clean container is a practical approximation of a new user when no second person is available. For higher-stakes tutorials, hand the draft and a fresh environment to someone who didn’t write it and watch where they stop.

Which tutorial should you test first?

If you’re choosing what to re-test, start where the traffic is: your most-viewed quickstart, the tutorial attached to your highest-friction onboarding step, or the page support keeps quoting back at users.

If tutorials are breaking faster than your team can re-run them, the fix is a process: pinned versions, a fresh-environment test, and a test record, before more articles get commissioned.

My developer adoption audit and launch packages and developer education services cover this testing work end to end: building the workflow, reporting the product bugs it surfaces, and writing the verified tutorial. Bring one tutorial and the failure reports you’re seeing to a developer adoption review call, and we can identify what needs testing first. More about my engineering and technical writing background is on the about page.

Sources