Unit Test the Docs: Why You Should Test Your Code Examples

Sketchnote

Sketchnote

Description

What’s the fastest way to make developers complain about your docs? Give them code examples that don’t work.

As technical writers, we face the constant challenge of keeping code examples accurate and up-to-date. Just as software developers write unit tests to validate that their code remains functional, technical writers can create code examples within unit tests to validate that their documentation is correct.

In this talk you will learn:

  • Why you should write code examples within unit tests
  • What you should test
  • How to implement tested code examples
  • How to set up continuous integration tests to make sure that code examples always work
  • Conference: Write the Docs Portland
  • Year: 2022

About the speaker

Ben Perlmutter