testthat: Unit Testing for R

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

Install the latest version of this package by entering the following in R:
install.packages("testthat")
AuthorHadley Wickham [aut, cre], RStudio [cph]
Date of publication2016-04-23 08:37:40
MaintainerHadley Wickham <hadley@rstudio.com>
LicenseMIT + file LICENSE
Version1.0.2
https://github.com/hadley/testthat

View on CRAN

Man pages

auto_test: Watches code and tests for changes, rerunning tests as...

auto_test_package: Watches a package for changes, rerunning tests as...

CheckReporter: Check reporter: 13 line summary of problems

compare: Provide human-readable comparison of two objects

compare_state: Compare two directory states.

comparison-expectations: Expectation: is returned value less or greater than specified...

context: Describe the context of a set of tests.

describe: describe: a BDD testing language

dir_state: Capture the state of a directory.

equality-expectations: Expectation: is the object equal to a value?

evaluate_promise: Evaluate a promise, capturing all types of output.

expectation: Expectation class.

expect_cpp_tests_pass: Test Compiled Code in a Package

expect_equal_to_reference: Expectation: is the object equal to a reference value stored...

expect_length: Expectation: does a vector have the specified length?

expect_match: Expectation: does string/output/message/warning/error match a...

expect_named: Expectation: does object have names?

expect_success: Tools for testing expectations

expect_that: Expect that a condition holds.

fail: Default expectations that alway succeed or fail.

FailReporter: Test reporter: fail at end.

find_reporter: Find reporter object given name or object.

find_test_scripts: Find the test files.

inheritance-expectations: Expectation: does the object inherit from a S3 or S4 class,...

ListReporter: List reporter: gather all test results along with elapsed...

logical-expectations: Expectation: is the object true/false?

make_expectation: Make an equality test.

MinimalReporter: Test reporter: minimal.

MultiReporter: Multi reporter: combine several reporters in one.

not: Negate an expectation

oldskool: Old-style expectations.

output-expectations: Expectation: does code produce output/message/warning/error?

reexports: Objects exported from other packages

Reporter: Stub object for managing a reporter of tests.

reporter-accessors: Get/set reporter; execute code in specified reporter.

RstudioReporter: Test reporter: RStudio

safe_digest: Compute a digest of a filename, returning NA if the file...

SilentReporter: Test reporter: gather all errors silently.

skip: Skip a test.

source_file: Source a file, directory, or all helpers.

StopReporter: Test reporter: stop on error.

SummaryReporter: Test reporter: summary of errors.

takes_less_than: Expectation: does expression take less than a fixed amount of...

TapReporter: Test reporter: TAP format.

TeamcityReporter: Test reporter: Teamcity format.

test_dir: Run all of the tests in a directory.

test_env: Generate default testing environment.

test_examples: Test package examples

test_file: Run all tests in specified file.

test_package: Run all tests in an installed package.

test_path: Locate file in testing directory.

testthat: R package to make testing fun!

test_that: Create a test.

testthat_results: Create a 'testthat_results' object from the test results as...

try_again: Try evaluating an expressing multiple times until it...

use_catch: Use Catch for C++ Unit Testing

watch: Watch a directory for changes (additions, deletions &...

with_mock: Mock functions in a package.

Functions

\%>\% Man page
auto_test Man page
auto_test_package Man page
capture_messages Man page
capture_output Man page
capture_warnings Man page
CheckReporter Man page
compare Man page
compare.character Man page
compare.default Man page
compare.numeric Man page
compare.POSIXt Man page
compare_state Man page
comparison-expectations Man page
context Man page
describe Man page
dir_state Man page
equality-expectations Man page
equals Man page
equals_reference Man page
evaluate_promise Man page
expect Man page
expectation Man page
expect_cpp_tests_pass Man page
expect_equal Man page
expect_equal_to_reference Man page
expect_equivalent Man page
expect_error Man page
expect_failure Man page
expect_false Man page
expect_gt Man page
expect_gte Man page
expect_identical Man page
expect_is Man page
expect_length Man page
expect_less_than Man page
expect_lt Man page
expect_lte Man page
expect_match Man page
expect_message Man page
expect_more_than Man page
expect_named Man page
expect_null Man page
expect_output Man page
expect_output_file Man page
expect_s3_class Man page
expect_s4_class Man page
expect_silent Man page
expect_success Man page
expect_that Man page
expect_true Man page
expect_type Man page
expect_warning Man page
fail Man page
FailReporter Man page
find_reporter Man page
find_test_scripts Man page
get_reporter Man page
gives_warning Man page
has_names Man page
inheritance-expectations Man page
is_a Man page
is_equivalent_to Man page
is.expectation Man page
is_false Man page
is_identical_to Man page
is_less_than Man page
is_more_than Man page
is_null Man page
is_true Man page
ListReporter Man page
logical-expectations Man page
make_expectation Man page
matches Man page
MinimalReporter Man page
MultiReporter Man page
not Man page
oldskool Man page
output-expectations Man page
prints_text Man page
reexports Man page
Reporter Man page
reporter-accessors Man page
RstudioReporter Man page
safe_digest Man page
set_reporter Man page
shows_message Man page
SilentReporter Man page
skip Man page
skip_if_not Man page
skip_if_not_installed Man page
skip_on_appveyor Man page
skip_on_bioc Man page
skip_on_cran Man page
skip_on_os Man page
skip_on_travis Man page
source_dir Man page
source_file Man page
source_test_helpers Man page
StopReporter Man page
succeed Man page
SummaryReporter Man page
takes_less_than Man page
TapReporter Man page
TeamcityReporter Man page
test_check Man page
test_dir Man page
test_env Man page
test_example Man page
test_examples Man page
test_file Man page
test_package Man page
test_path Man page
testthat Man page
test_that Man page
testthat-package Man page
testthat_results Man page
throws_error Man page
try_again Man page
use_catch Man page
watch Man page
with_mock Man page
with_reporter Man page

Files

inst
inst/CITATION
inst/resources
inst/resources/test-cpp.R
inst/resources/test-runner.cpp
inst/resources/test-example.cpp
inst/include
inst/include/testthat.h
inst/include/testthat
inst/include/testthat/vendor
inst/include/testthat/vendor/catch.h
inst/include/testthat/testthat.h
tests
tests/test-catch.R tests/testthat.R
tests/testthat
tests/testthat/test-evaluate-promise.R tests/testthat/test-expect-output.R tests/testthat/test-reporter-tap.R tests/testthat/test-expect-equal-to-reference.R tests/testthat/test-compare-time.R tests/testthat/test-expect_that.R tests/testthat/test-cpp.R tests/testthat/test-label.R
tests/testthat/test_dir
tests/testthat/test_dir/test-bare-expectations.R tests/testthat/test_dir/test-helper.R tests/testthat/test_dir/test-empty.R tests/testthat/test_dir/test-skip.R tests/testthat/test_dir/test-failures.R tests/testthat/test_dir/test-basic.R tests/testthat/test_dir/test-errors.R tests/testthat/test_dir/helper_hello.R tests/testthat/test-test-that.R tests/testthat/test-colour.R tests/testthat/test-reporter.R tests/testthat/test-expect-named.R tests/testthat/test-not.R
tests/testthat/test-path-present
tests/testthat/test-path-present/tests
tests/testthat/test-path-present/tests/testthat
tests/testthat/test-path-present/tests/testthat/empty
tests/testthat/test-context.R tests/testthat/test-reporter-list.R tests/testthat/test-expect-length.R tests/testthat/test-source_dir.R tests/testthat/test-old-school.R tests/testthat/test-bare.R tests/testthat/test-test_dir.R tests/testthat/test-expect-null.R
tests/testthat/test-path-missing
tests/testthat/test-path-missing/empty
tests/testthat/test-compare-character.R tests/testthat/test-expect-self-test.R tests/testthat/test-expect-warning.R
tests/testthat/one.rds
tests/testthat/test-expect-silent.R
tests/testthat/reporters
tests/testthat/reporters/silent.txt
tests/testthat/reporters/tap.txt
tests/testthat/reporters/teamcity.txt
tests/testthat/reporters/check.txt
tests/testthat/reporters/summary.txt
tests/testthat/reporters/rstudio.txt
tests/testthat/reporters/tests.R
tests/testthat/reporters/minimal.txt
tests/testthat/test-catch.R tests/testthat/test-comparisons.R tests/testthat/test-helpers.R tests/testthat/test-reporter-multi.R tests/testthat/test-compare-numeric.R tests/testthat/test-describe.R tests/testthat/test-test-path.R tests/testthat/test-try-again.R tests/testthat/test-expect-logical.R tests/testthat/test-expect-message.R tests/testthat/test-expect-error.R tests/testthat/test-expect-inheritance.R tests/testthat/test-expect-match.R tests/testthat/test-mock.R tests/testthat/helper-assign.R tests/testthat/test-expect-equality.R tests/testthat/test-environment.R tests/testthat/context.R tests/testthat/test-watcher.R
src
src/Makevars
src/test-runner.cpp
src/test-example.cpp
src/test-catch.cpp
src/Makevars.win
src/label.c
src/reassign.c
NAMESPACE
NEWS.md
R
R/old-school.R R/reporter.R R/reporter-check.R R/test-files.R R/utils.R R/expect-named.R R/expectations-matches.R R/mock.R R/reporter-list.R R/evaluate-promise.R R/colour-text.R R/expect-output.R R/expect-length.R R/expect-comparison.R R/expectation.R R/expect-inheritance.R R/reporter-teamcity.R R/compare-numeric.R R/skip.R R/test-path.R R/make-expectation.R R/auto-test.R R/test-example.R R/expect-equal-to-reference.R R/compare-character.R R/reporter-multi.R R/reporter-rstudio.R R/test-compiled-code.R R/reporter-stop.R R/watcher.R R/reporter-silent.R R/source.R R/reporter-tap.R R/test-that.R R/compare-time.R R/try-again.R R/test-package.R R/stack.R R/expect-self-test.R R/expect-equality.R R/reporter-summary.R R/reporter-fail.R R/compare.R R/expect-logical.R R/praise.R R/expect-that.R R/reporter-minimal.R R/describe.R R/context.R R/traceback.R R/reporter-zzz.R
README.md
MD5
DESCRIPTION
man
man/FailReporter.Rd man/test_file.Rd man/test_path.Rd man/SilentReporter.Rd man/try_again.Rd man/describe.Rd man/test_package.Rd man/fail.Rd man/find_reporter.Rd man/compare_state.Rd man/expect_length.Rd man/make_expectation.Rd man/equality-expectations.Rd man/Reporter.Rd man/TeamcityReporter.Rd man/test_examples.Rd man/output-expectations.Rd man/expect_that.Rd man/TapReporter.Rd man/SummaryReporter.Rd man/expectation.Rd man/test_env.Rd man/test_that.Rd man/RstudioReporter.Rd man/auto_test_package.Rd man/takes_less_than.Rd man/MultiReporter.Rd man/test_dir.Rd man/with_mock.Rd man/MinimalReporter.Rd man/comparison-expectations.Rd man/evaluate_promise.Rd man/auto_test.Rd man/expect_cpp_tests_pass.Rd man/reexports.Rd man/compare.Rd man/expect_named.Rd man/dir_state.Rd man/CheckReporter.Rd man/expect_success.Rd man/logical-expectations.Rd man/expect_equal_to_reference.Rd man/expect_match.Rd man/context.Rd man/testthat.Rd man/ListReporter.Rd man/safe_digest.Rd man/not.Rd man/reporter-accessors.Rd man/watch.Rd man/use_catch.Rd man/StopReporter.Rd man/testthat_results.Rd man/source_file.Rd man/skip.Rd man/find_test_scripts.Rd man/oldskool.Rd man/inheritance-expectations.Rd
LICENSE

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.