What problem does it solve?
It prevents regressions and fragile refactors in R code by enforcing a test-first (TDD) workflow with consistently high test coverage using testthat.
Core Features & Use Cases
- Test-first development: write failing testthat tests before implementing the corresponding R code.
- Coverage guardrails: target 80%+ coverage overall, including strict expectations for statistical calculations and data validation logic.
- Multiple test types: unit, integration, and snapshot tests to keep behavior correct and stable as the codebase evolves.
- Package-native organization: organize tests into tests/testthat with fixtures, helpers, and setup files to support reproducible checks.
- Common R development scenarios: apply when adding new functions, fixing bugs, refactoring, extending models, building data pipelines, or developing Shiny components.
Quick Start
Tell your AI to set up testthat for your R package, then generate a failing unit test for the function you plan to write and help you implement the minimum code to make it pass while tracking coverage toward 80%+.