# Tests ## Overview The package uses the [`testthat`](https://testthat.r-lib.org/) framework for unit testing and as a test runner. Any contribution to the code of the package must include tests that conform to the style of existing testing. ### Coverage Complete and high test coverage is a priority and goal in the package to ensure a stable and reliable user experience. We use [`covr`](https://covr.r-lib.org/) for computing and tracking test coverage. [`covr`](https://covr.r-lib.org/) results are uploaded to [`codecov`](https://codecov.io/gh/openaq/openaq-r) and automatic through github actions, see [https://github.com/openaq/openaq-r/blob/main/.github/workflows/test-coverage.yaml](https://github.com/openaq/openaq-r/blob/main/.github/workflows/test-coverage.yaml). ## Mocking ### Fixtures YAML test fixures are generated using `vcr` and based off a local deployment of the [OpenAQ database](https://github.com/openaq/openaq-db) and [OpenAQ API](https://github.com/openaq/openaq-api-v2) instead of the live hosted instance. This is to provide a reproduceable and predictable test cases. JSON test fixtures are generated by [JSON schema faker](https://json-schema-faker.js.org/) based on JSON schemas derived from the OpenAQ API [Pydantic](https://docs.pydantic.dev/latest/) models.