Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API mocking for package tests #147

Open
nickdickinson opened this issue Dec 15, 2024 · 0 comments
Open

API mocking for package tests #147

nickdickinson opened this issue Dec 15, 2024 · 0 comments

Comments

@nickdickinson
Copy link
Collaborator

API mocking would be useful for the following:

  • Reduce the number of API calls during testing of non-mutating interactions and enable periodic update of mocking as needed
  • Run vignettes using mocking to avoid authentication and the need to keep resources online making them easier to maintain as the R package changes
  • Enabling the tests to run in CRAN so that the package can be submitted to CRAN. Alternatively we could disable testing in CRAN for tests that use the API/internet.
  • Potentially use also in the Roxygen examples

The space has grown considerably with the following useful packages:

  • vcr (httr and httr2 supported
  • httptest (for httr) or httptest2 (for httr2)
  • webmockr

This is a good introduction to API mocking in R: https://books.ropensci.org/http-testing/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant