tests/Readme.md

Notes on testing ROhdsiWebApi

ROhdsiWebApi tests rely on the httptest package which caches data retrieved from a webapi instance and "mocks" the webapi endpoint in subsequent tests.

Every file in the R/ folder has a corresponding test file in the tests/testthat/ folder. In addition cached data for each test file is stored in a corresponding folder inside tests/testthat/mocks/.

For example:

To update test you will likely want to delete the cache for the specific file you are working on. For example if you want to add more tests for functions in Generation.R you would delete the tests/testthat/mocks/Generation/ folder so that the cache is refreshed and includes data needed for your new tests.

To refresh all of the cached data delete tests/testthat/mocks/ and rerun all tests.

Not all of the functions use cached data (such as the authorization functions) but it is preferred that new tests are called with with_mock_dir so they will use cached data if available.



OHDSI/ROhdsiWebApi documentation built on March 15, 2023, 1:23 p.m.