Instantly share code, notes, and snippets.

@0atman /README.md
Last active Sep 25, 2017

Embed
What would you like to do?
The Testable Documentation Manifesto

#! blaze sh

The Testable Documentation Manifesto

One of the problems with tech documentation (api, installation instructions etc) is that they get stale. APIs change, software and plugins alter their interface and commands, and websites go away.

To solve this, I propose we write our documentation in a way that can be executed, or verified.

Luckily, I wrote blaze to execute codeblocks inside of markdown, which means that with a little help from a few common unix tools, we can solve this problem.

Testable Software Installation Example

set -e
pip install badpackage_123183183

The output of executing the very file you are reading now is:

$ ./README.md

Collecting badpackage_123183183

Could not find a version that satisfies the requirement badpackage_123183183 (from versions: ) No matching distribution found for badpackage_123183183

You now can execute your readme instructions as part of your build process (perhaps with a little setup beforehand, such as running it inside a container), and the exit code (in this case 1) will allow you to fail the build if the instructions are out of date.

In this repository there are other examples:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment