- Notifications
You must be signed in to change notification settings - Fork339
An R 📦 to make testing 😀
License
Unknown, MIT licenses found
Licenses found
r-lib/testthat
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Testing your code can be painful and tedious, but it greatly increasesthe quality of your code.testthat tries to make testing as fun aspossible, so that you get a visceral satisfaction from writing tests.Testing should be addictive, so you do it all the time. To make thathappen, testthat:
Provides functions that make it easy to describe what you expect afunction to do, including catching errors, warnings, and messages.
Easily integrates in your existing workflow, whether it’s informaltesting on the command line, building test suites, or using R CMDcheck.
Displays test progress visually, showing a pass, fail, or error forevery expectation. If you’re using the terminal or a recent version ofRStudio, it’ll even colour the output.
testthat draws inspiration from the xUnit family of testing packages, aswell as from many of the innovative ruby testing libraries, likerspec,testy,bacon andcucumber.
testthat is the most popular unit testing package for R and is used bythousands of CRAN packages.
If you’re not familiar with testthat, thetestingchapter inRpackages gives a good overview, along with workflowadvice and concrete examples.
# Install the released version from CRANinstall.packages("testthat")# Or the development version from GitHub:# install.packages("pak")pak::pak("r-lib/testthat")
The easiest way to get started is withusethis. Assuming you’re in apackage directory, just runusethis::use_test("name") to create a testfile, and set up all the other infrastructure you need. If you’re usingRStudio, press Cmd/Ctrl + Shift + T (or rundevtools::test() if not)to run all the tests in a package.
About
An R 📦 to make testing 😀
Topics
Resources
License
Unknown, MIT licenses found
Licenses found
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
