# testthat

> Unit testing for R

Source: https://talira.ai/catalog/testthat-7gmdb2r0
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / testing / frameworks](https://talira.ai/categories/developer-tools/testing/frameworks)
- Licence: MIT[^2]
- Pricing: Free and open source[^1]
- Pricing notes: Free and open source.
- Free tier: yes[^1]
- Backed by: [Posit](https://talira.ai/orgs/posit.md)
- Creator: Hadley Wickham

testthat is the most widely used unit testing framework for [R](https://talira.ai/catalog/r-jj1se4aq.md) packages. Tests are written with `test_that()` blocks and `expect_*()` expectations (equality, errors, warnings, output and more), and snapshot tests record printed output, errors or images and flag any change. It runs from the R console, from `devtools::test()` or during `R CMD check`, reports results as it goes, and supports mocking, test fixtures and parallel runs. It's maintained by Hadley Wickham and Posit as part of the r-lib collection.

## Links

- Website: https://testthat.r-lib.org/
- GitHub: https://github.com/r-lib/testthat
- Docs: https://testthat.r-lib.org/reference/

## Problems it solves

- write unit tests for my R package
- check that my R function throws the right error
- snapshot test printed output and plots in R
- run my R package's tests during R CMD check

## Features

- test_that blocks with expect_* expectations
- snapshot tests for output, errors and images
- mocking and test fixtures
- parallel test runs
- runs under devtools::test() and R CMD check

## Trust

Overall: 0.47 out of 1.
Signals: maintenance 0.49, adoption 0.60, momentum 0.22, community 0.87, backing 0.50, extensibility 0.00.

- last commit 55 days ago
- 6 commits in the last 90 days
- latest release v3.3.2 10 months ago
- 944 GitHub stars
- 148 contributors
- backed by Posit
- created by Hadley Wickham

## Related

- Works with [R](https://talira.ai/catalog/r-jj1se4aq.md)

## Sources

[^1]: https://github.com/r-lib/testthat/blob/main/LICENSE.md (checked 23 Nov 2026)
[^2]: https://github.com/r-lib/testthat/blob/main/DESCRIPTION (checked 23 Nov 2026)
