testthat v1.0.2


Monthly downloads



by Hadley Wickham

Unit Testing for R

A unit testing system designed to be fun, flexible and easy to set up.

Functions in testthat

Name Description
auto_test Watches code and tests for changes, rerunning tests as appropriate.
expect_named Expectation: does object have names?
expect_cpp_tests_pass Test Compiled Code in a Package
MinimalReporter Test reporter: minimal.
SummaryReporter Test reporter: summary of errors.
fail Default expectations that alway succeed or fail.
ListReporter List reporter: gather all test results along with elapsed time and file information.
auto_test_package Watches a package for changes, rerunning tests as appropriate.
test_examples Test package examples
evaluate_promise Evaluate a promise, capturing all types of output.
testthat_results Create a `testthat_results` object from the test results as stored in the ListReporter results field.
TeamcityReporter Test reporter: Teamcity format.
oldskool Old-style expectations.
FailReporter Test reporter: fail at end.
test_file Run all tests in specified file.
test_env Generate default testing environment.
testthat R package to make testing fun!
source_file Source a file, directory, or all helpers.
MultiReporter Multi reporter: combine several reporters in one.
expect_match Expectation: does string/output/message/warning/error match a regular expression?
use_catch Use Catch for C++ Unit Testing
context Describe the context of a set of tests.
test_path Locate file in testing directory.
not Negate an expectation
CheckReporter Check reporter: 13 line summary of problems
equality-expectations Expectation: is the object equal to a value?
compare Provide human-readable comparison of two objects
logical-expectations Expectation: is the object true/false?
Reporter Stub object for managing a reporter of tests.
test_dir Run all of the tests in a directory.
expect_length Expectation: does a vector have the specified length?
expect_that Expect that a condition holds.
expectation Expectation class.
compare_state Compare two directory states.
SilentReporter Test reporter: gather all errors silently.
make_expectation Make an equality test.
StopReporter Test reporter: stop on error.
safe_digest Compute a digest of a filename, returning NA if the file doesn't exist.
TapReporter Test reporter: TAP format.
test_package Run all tests in an installed package.
find_reporter Find reporter object given name or object.
inheritance-expectations Expectation: does the object inherit from a S3 or S4 class, or a base type?
watch Watch a directory for changes (additions, deletions & modifications).
dir_state Capture the state of a directory.
RstudioReporter Test reporter: RStudio
describe describe: a BDD testing language
expect_success Tools for testing expectations
find_test_scripts Find the test files.
try_again Try evaluating an expressing multiple times until it succeeds.
with_mock Mock functions in a package.
reporter-accessors Get/set reporter; execute code in specified reporter.
reexports Objects exported from other packages
takes_less_than Expectation: does expression take less than a fixed amount of time to run?
test_that Create a test.
output-expectations Expectation: does code produce output/message/warning/error?
comparison-expectations Expectation: is returned value less or greater than specified value?
expect_equal_to_reference Expectation: is the object equal to a reference value stored in a file?
skip Skip a test.
No Results!

Last month downloads


URL https://github.com/hadley/testthat
BugReports https://github.com/hadley/testthat/issues
License MIT + file LICENSE
Collate 'auto-test.R' 'colour-text.R' 'compare.R' 'compare-character.R' 'compare-numeric.R' 'compare-time.R' 'context.R' 'describe.R' 'evaluate-promise.R' 'expect-comparison.R' 'expect-equal-to-reference.R' 'expect-equality.R' 'expect-inheritance.R' 'expect-length.R' 'expect-logical.R' 'expect-named.R' 'expect-output.R' 'reporter.R' 'expect-self-test.R' 'expect-that.R' 'expectation.R' 'expectations-matches.R' 'make-expectation.R' 'mock.R' 'old-school.R' 'praise.R' 'reporter-check.R' 'reporter-fail.R' 'reporter-list.R' 'reporter-minimal.R' 'reporter-multi.R' 'reporter-rstudio.R' 'reporter-silent.R' 'reporter-stop.R' 'stack.R' 'reporter-summary.R' 'reporter-tap.R' 'reporter-teamcity.R' 'reporter-zzz.R' 'skip.R' 'source.R' 'test-compiled-code.R' 'test-example.R' 'test-files.R' 'test-package.R' 'test-path.R' 'test-that.R' 'traceback.R' 'try-again.R' 'utils.R' 'watcher.R'
RoxygenNote 5.0.1
NeedsCompilation yes
Packaged 2016-04-22 20:14:31 UTC; hadley
Repository CRAN
Date/Publication 2016-04-23 08:37:40

Include our badge in your README