Are you working on an R package accessing resources on the web, be it a cat facts API, a scientific data source or your system for Customer relationship management? As with all other packages, appropriate unit testing can make your code more robust. The unit testing of a package interacting with web resources, however, brings special challenges: dependence of tests on a good internet connection, testing in the absence of authentication secrets, etc. Having tests fail due to resources being down or slow, during development or on CRAN, means a time loss for everyone involved (slower development, messages from CRAN). Although some packages accessing remote resources are well tested, there is a lack of resources around best practices.
This book is meant to be a free, central reference for developers of R packages accessing web resources, to help them have a faster and more robust development. Our aim is to develop a useful guide to go with the great recent tools vcr, webmockr, httptest, httptest2 and webfakes.
Note related to previous versions: this book was intended as a detailed guide to using a particular suite of packages for HTTP mocking and testing in R code and/or packages, namely those maintained by Scott Chamberlain (crul, webmockr, vcr), but its scope has been extended to generalize the explanation of concepts to similar packages.