testthat is a unit testing framework for R that makes it easy to write and run tests for your code. It provides functions to define expectations, capture errors and warnings, and integrates with standard R package development workflows.
The package offers visual progress reporting with colored output, integrates seamlessly into both informal command-line testing and formal R CMD check processes, and draws from established testing frameworks like xUnit and rspec. It’s the most widely-used testing package in the R ecosystem, adopted by thousands of CRAN packages. The framework is designed to make testing straightforward enough that it becomes a regular part of development rather than an afterthought.