~/talk

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

Talkat Write the Docs Portland 2022 · 2022-05-22..05-24· [testing]
links:none on file
slides:none on file

Argues that code examples must be executable and kept as a single source of truth by extracting them from tests and transcluding into docs, using the realm node.js sdk and jest assertions, running CI checks via GitHub Actions, and generating snippet files with bluehawk. Describes two flows copy paste versus extract and transclude, reports 41 contributors across eight SDKs and over 2,000 code examples, and shows a CLI build that produces committed, reproducible snippet files.

AI-written summary · about

  1. 0:00Start
  2. 1:59Unit Tests & Code Examples
  3. 4:12Challenges Documenting Code Examples
  4. 8:57Considerations
  5. 10:14When to test code examples
  6. 12:10Implementation
  7. 13:34Copy Code Example
  8. 18:02Bluehawk: A Brief History
  9. 19:56Bluehawk Walkthrough
  10. 24:01Add Code Example to Unit Test
  11. 24:19Annotate Unit Test with Code to Extract
  12. 28:14Continuous Integration
  13. 28:55Why CI Test Code Examples
  14. 30:22Why Unit Test Code Examples
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.