Learn R Programming

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

testthat (version 0.11.0)

Unit Testing for R

Description

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

Copy Link

Version

Install

install.packages('testthat')

Monthly Downloads

578,511

Version

0.11.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Hadley Wickham

Last Published

October 14th, 2015

Functions in testthat (0.11.0)

expect_that

Expect that a condition holds.
reporter-accessors

Get/set reporter; execute code in specified reporter.
SummaryReporter-class

Test reporter: summary of errors.
TapReporter-class

Test reporter: TAP format.
source_test_helpers

Source the helper scripts if any.
auto_test

Watches code and tests for changes, rerunning tests as appropriate.
make_expectation

Make an equality test.
CheckReporter-class

Check reporter: 13 line summary of problems
TeamcityReporter-class

Test reporter: Teamcity format.
succeed

A default expectation that always succeeds.
expect-compare

Expectation: is returned value less or greater than specified value?
dir_state

Capture the state of a directory.
source_dir

Load all source files in a directory.
test_that

Create a test.
skip

Skip a test.
find_reporter

Find reporter object given name or object.
testthat

R package to make testing fun!
test_examples

Test package examples
evaluate_promise

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

Test reporter: gather all errors silently.
matching-expectations

Expectation: does string/output/message/warning/error match a regular expression?
compare_state

Compare two directory states.
safe_digest

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

Test reporter: RStudio
with_mock

Mock functions in a package.
not

Negate an expectation
equals

Old-style expectations.
expect_silent

Expect that code has no output, messages, or warnings.
MultiReporter-class

Multi reporter: combine several reporters in one.
setup_test_dir

Take care or finding the test files and sourcing the helpers.
equivalence

Expectation: is the object equal to a value?
watch

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

Expectation: is the object true/false?
Reporter-class

Stub object for managing a reporter of tests.
test_file

Run all tests in specified file.
compare

Provide human-readable comparison of two objects
test_dir

Run all of the tests in a directory.
fail

A default expectation that always fails.
test_package

Run all tests in an installed package.
find_test_scripts

Find the test files.
StopReporter-class

Test reporter: stop on error.
ListReporter-class

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

Expectation: does object have names?
expectation

Expectation class.
test_env

Generate default testing environment.
testthat_results

Create a `testthat_results` object from the test results as stored in the ListReporter results field.
describe

describe: a BDD testing language
takes_less_than

Expectation: does expression take less than a fixed amount of time to run?
MinimalReporter-class

Test reporter: minimal.
auto_test_package

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

Describe the context of a set of tests.
expect_is

Expectation: does the object inherit from a class?
expect_null

Expectation: is the object NULL?
expect_equal_to_reference

Expectation: is the object equal to a reference value stored in a file?