Learn R Programming

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

testthat (version 0.10.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

467,612

Version

0.10.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Hadley Wickham

Last Published

May 22nd, 2015

Functions in testthat (0.10.0)

expect_equal_to_reference

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

Test reporter: Teamcity format.
context

Describe the context of a set of tests.
source_dir

Load all source files in a directory.
compare

Provide human-readable comparison of two objects
equivalence

Expectation: is the object equal to a value?
ListReporter-class

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
watch

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

Make an equality test.
auto_test

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

Expectation: is the object true/false?
compare_state

Compare two directory states.
TapReporter-class

Test reporter: TAP format.
StopReporter-class

Test reporter: stop on error.
setup_test_dir

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

Generate default testing environment.
expect-compare

Expectation: is returned value less or greater than specified value?
matching-expectations

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

Run all tests in specified file.
safe_digest

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

Skip a test.
expect_null

Expectation: is the object NULL?
not

Negate an expectation
Reporter-class

Stub object for managing a reporter of tests.
reporter-accessors

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

Capture the state of a directory.
succeed

A default expectation that always succeeds.
find_test_scripts

Find the test files.
find_reporter

Find reporter object given name or object.
CheckReporter-class

Check reporter: 13 line summary of problems
testthat_results

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

Source the helper scripts if any.
RstudioReporter-class

Test reporter: RStudio
expect_named

Expectation: does object have names?
MinimalReporter-class

Test reporter: minimal.
test_package

Run all tests in an installed package
expectation

Expectation class.
takes_less_than

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

describe: a BDD testing language
expect_that

Expect that a condition holds.
test_that

Create a test.
MultiReporter-class

Multi reporter: combine several reporters in one.
fail

A default expectation that always fails.
SilentReporter-class

Test reporter: gather all errors silently.
evaluate_promise

Evaluate a promise, capturing all types of output.
equals

Old-style expectations.
with_mock

Mock functions in a package.
SummaryReporter-class

Test reporter: summary of errors.
expect_is

Expectation: does the object inherit from a class?
test_dir

Run all of the tests in a directory.
testthat

R package to make testing fun!