Learn R Programming

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

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

License

GPL

Maintainer

Hadley Wickham

Last Published

November 30th, 2009

Functions in testthat (0.1.1)

SummaryReporter

Test reporter: summary of errors.
equals

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

Stub object for managing a reporter of tests.
dir_state

Capture the state of a directory.
compare_state

Compare two directory states.
is_true

Expectation: is the object true?
throws_error

Expectation: does expression throw an error?
auto_test_package

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

Describe the context of a set of tests.
with_reporter

Execute code in specified reporter.
is_false

Expectation: is the object false?
takes_less_than

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

Create a test.
auto_test

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

Try, capture stack on error.
create_traceback

Generate a traceback from a list of calls.
StopReporter

Test reporter: stop on error.
reporter_accessors

Access current reporter.
error_report

Generate error report from traceback.
watch

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

Expectation: does printed output match a regular expression?
matches

Expectation: does string match regular expression?
is_identical_to

Expectation: is the object identical to another?
MinimalReporter

Test reporter: minimal.
find_reporter

Find reporter object given name...
colourise

Colourise text for display in the terminal.
expectation

Expectation class.
expect_that

Expect that a condition holds.
test_dir

Run all of the tests in a directory.
is_a

Expectation: does the object inherit from a class?
test_file

Run all tests in specified file.
source_dir

Load all source files in a directory.
library_if_available

Load package, if available.
reporter-accessors

Get/set reporter; execute code in specified reporter.
expect-compare

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

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

Test reporter: TAP format.
MultiReporter-class

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

Test reporter: summary of errors.
fail

A default expectation that always fails.
safe_digest

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

Stub object for managing a reporter of tests.
StopReporter-class

Test reporter: stop on error.
TeamcityReporter-class

Test reporter: Teamcity format.
ListReporter-class

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

Negate an expectation
evaluate_promise

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

Test reporter: minimal.
expect_null

Expectation: is the object NULL?
setup_test_dir

Take care or finding the test files and sourcing the helpers.
matching-expectations

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

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

Check reporter: 13 line summary of problems
RstudioReporter-class

Test reporter: RStudio
test_package

Run all tests in an installed package
testthat

R package to make testing fun!
expect_equal_to_reference

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

A default expectation that always succeeds.
make_expectation

Make an equality test.
test_env

Generate default testing environment.
compare

Provide human-readable comparison of two objects
SilentReporter-class

Test reporter: gather all errors silently.
skip

Skip a test.
expect_named

Expectation: does object have names?
with_mock

Mock functions in a package.
testthat_results

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

describe: a BDD testing language
find_test_scripts

Find the test files.
source_test_helpers

Source the helper scripts if any.
expect_is

Expectation: does the object inherit from a class?
expect_silent

Expect that code has no output, messages, or warnings.
test_examples

Test package examples