With HTTP testing you can test the behavior of your package in case of an API error without having to actually trigger an API error. This is important for testing your package’s gracefulness (informative error message for the user) and robustness (if you e.g. use retrying in case of API errors).
- Use webmockr as in our demo.
Edit a vcr cassette; be careful to skip this test when vcr is off with
- With httptest or httptest2, edit a mock file as in our demo, or create it from scratch.
- With webfakes, choose what to return, have a specific app for the test, see our demo.