testthat: Get Started with Testing

Software testing is important, but many of us don’t do it because it is frustrating and boring. testthat is a new testing framework for R that is easy learn and use, and integrates with your existing workflow. This paper shows how, with illustrations from existing packages.

Hadley Wickham

CRAN packages used

testthat, RUnit, svUnit, stringr, lubridate

CRAN Task Views implied by cited packages

ReproducibleResearch, TimeSeries


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Wickham, "The R Journal: testthat: Get Started with Testing", The R Journal, 2011

BibTeX citation

  author = {Wickham, Hadley},
  title = {The R Journal: testthat: Get Started with Testing},
  journal = {The R Journal},
  year = {2011},
  note = {https://doi.org/10.32614/RJ-2011-002},
  doi = {10.32614/RJ-2011-002},
  volume = {3},
  issue = {1},
  issn = {2073-4859},
  pages = {5-10}