Learn R Programming

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

testthat (version 1.0.2)

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

397,049

Version

1.0.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Hadley Wickham

Last Published

April 23rd, 2016

Functions in testthat (1.0.2)

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.