Learn R Programming

⚠️There's a newer version (3.2.3) of this package.Take me there.

testthat (version 0.8.1)

Testthat code. Tools to make testing fun :)

Description

A testing package specifically tailored for R that's fun, flexible and easy to set up.

Copy Link

Version

Install

install.packages('testthat')

Monthly Downloads

467,612

Version

0.8.1

License

MIT + file LICENSE

Maintainer

Hadley Wickham

Last Published

February 21st, 2014

Functions in testthat (0.8.1)

equals

Expectation: is the object equal (with numerical tolerance) to a value?
auto_test

Watches code and tests for changes, rerunning tests as appropriate.
reporter-accessors

Get/set reporter; execute code in specified reporter.
context

Describe the context of a set of tests.
gives_warning

Expectation: does expression give a warning?
dir_state

Capture the state of a directory.
find_reporter

Find reporter object given name
expect_that

Expect that a condition holds.
is_a

Expectation: does the object inherit from a class?
has_names

Expectation: does object have names?
not

Negate an expectation
fail

A default expectation that always fails.
test_package

Run all tests in an installed package
prints_text

Expectation: does printed output match a regular expression?
watch

Watch a directory for changes (additions, deletions & modifications).
colourise

Colourise text for display in the terminal.
matches

Expectation: does string match regular expression?
library_if_available

Load package, if available.
test_that

Create a test.
auto_test_package

Watches a package for changes, rerunning tests as appropriate.
is_false

Expectation: is the object false?
StopReporter-class

Test reporter: stop on error.
source_dir

Load all source files in a directory.
is_identical_to

Expectation: is the object identical to another?
compare_state

Compare two directory states.
throws_error

Expectation: does expression throw an error?
evaluate_promise

Evaluate a promise, capturing all types of output.
TapReporter-class

Test reporter: TAP format.
make_expectation

Make an equality test.
is_true

Expectation: is the object true?
ListReporter-class

List reporter: gather all test results along with elapsed time and file information.
shows_message

Expectation: does expression show a message?
SilentReporter-class

Test reporter: gather all errors silently.
test_file

Run all tests in specified file.
test_env

Generate default testing environment.
is_equivalent_to

Expectation: is the object equivalent to a value? This expectation tests for equivalency: are two objects equal once their attributes have been removed.
is_null

Expectation: is the object NULL?
test_dir

Run all of the tests in a directory.
TeamcityReporter-class

Test reporter: Teamcity format.
SummaryReporter-class

Test reporter: summary of errors.
expect-compare

Expectation: is returned value less or greater than specified value?
MultiReporter-class

Multi reporter: combine several reporters in one.
MinimalReporter-class

Test reporter: minimal.
expectation

Expectation class.
Reporter-class

Stub object for managing a reporter of tests.
takes_less_than

Expectation: does expression take less than a fixed amount of time to run?
safe_digest

Compute a digest of a filename, returning NA if the file doesn't exist.