Beyond inline expectations

When you want to test

  • large/complicated output,

  • binary files like images,

  • error messages…

Think about snapshot testing!

From testthat third edition.

Another testthat trick

Custom skippers to run some tests only where you want.

Some built-in skippers: operating system, CRAN, etc.

Demo 🚀

What we just saw

  • Snapshot testing

  • Custom skippers

What about real requests?

Fixtures are great but what if the API output changed & we didn’t notice? 😱

Let’s schedule runs of continuous integration, where we turn off vcr.

Demo 🚀

How to get better at writing CI workflows?

Get inspired by others!

How to get better at testing?

  • Also get inspired by others!

  • Read testthat docs, the HTTP testing in R book, etc.

HTTP testing

  • vcr handy for usual workflows, and highly configurable.

  • Other HTTP testing packages: httptest, webfakes.

  • For databases, see dittodb!

Thank you, useR! team & participants!

Thanks in particular to Heather Turner (technical helper), Liz Hare (useR! accessibility team) and Yanina Bellini Saibene (global coordinator). And thanks to all other useR! volunteers!

Questions