R: Unit Testing for R

# Unit Testing for R

## Documentation for package ‘testthat’ version 3.3.2

- DESCRIPTION file
- User guides, package vignettes and other documentation
- Package NEWS
- Package README

## Help Pages

A C D E F I J L M P R S T U W

## -- A --

announce_snapshot_file | Do you expect this code to create the same file as last time?

## -- C --

CheckReporter | Report results for R CMD check
CompactProgressReporter | Report progress interactively
compare_file_binary | Do you expect this code to create the same file as last time?
compare_file_text | Do you expect this code to create the same file as last time?
comparison-expectations | Do you expect a value bigger or smaller than this?

## -- D --

DebugReporter | Interactively debug failing tests

## -- E --

edition_get | Temporarily change the active testthat edition
equality-expectations | Do you expect this value?
expect_all_equal | Do you expect every value in a vector to have this value?
expect_all_false | Do you expect every value in a vector to have this value?
expect_all_true | Do you expect every value in a vector to have this value?
expect_condition | Do you expect an error, warning, message, or other condition?
expect_contains | Do you expect a vector containing these values?
expect_disjoint | Do you expect a vector containing these values?
expect_equal | Do you expect this value?
expect_error | Do you expect an error, warning, message, or other condition?
expect_failure | Test your custom expectations
expect_false | Do you expect 'TRUE' or 'FALSE'?
expect_gt | Do you expect a value bigger or smaller than this?
expect_gte | Do you expect a value bigger or smaller than this?
expect_identical | Do you expect this value?
expect_in | Do you expect a vector containing these values?
expect_invisible | Do you expect the result to be (in)visible?
expect_length | Do you expect an object with this length or shape?
expect_lt | Do you expect a value bigger or smaller than this?
expect_lte | Do you expect a value bigger or smaller than this?
expect_mapequal | Do you expect a vector containing these values?
expect_match | Do you expect a string to match this pattern?
expect_message | Do you expect an error, warning, message, or other condition?
expect_named | Do you expect a vector with (these) names?
expect_no_condition | Do you expect the absence of errors, warnings, messages, or other conditions?
expect_no_error | Do you expect the absence of errors, warnings, messages, or other conditions?
expect_no_match | Do you expect a string to match this pattern?
expect_no_message | Do you expect the absence of errors, warnings, messages, or other conditions?
expect_no_warning | Do you expect the absence of errors, warnings, messages, or other conditions?
expect_null | Do you expect 'NULL'?
expect_output | Do you expect printed output to match this pattern?
expect_r6_class | Do you expect an S3/S4/R6/S7 object that inherits from this class?
expect_s3_class | Do you expect an S3/S4/R6/S7 object that inherits from this class?
expect_s4_class | Do you expect an S3/S4/R6/S7 object that inherits from this class?
expect_s7_class | Do you expect an S3/S4/R6/S7 object that inherits from this class?
expect_setequal | Do you expect a vector containing these values?
expect_shape | Do you expect an object with this length or shape?
expect_silent | Do you expect code to execute silently?
expect_snapshot | Do you expect this code to run the same way as last time?
expect_snapshot_failure | Test your custom expectations
expect_snapshot_file | Do you expect this code to create the same file as last time?
expect_snapshot_value | Do you expect this code to return the same value as last time?
expect_success | Test your custom expectations
expect_true | Do you expect 'TRUE' or 'FALSE'?
expect_type | Do you expect an S3/S4/R6/S7 object that inherits from this class?
expect_vector | Do you expect a vector with this size and/or prototype?
expect_visible | Do you expect the result to be (in)visible?
expect_warning | Do you expect an error, warning, message, or other condition?
extract_test | Extract a reprex from a failed expectation

## -- F --

fail | Declare that an expectation either passes or fails
FailReporter | Fail if any tests fail

## -- I --

inheritance-expectations | Do you expect an S3/S4/R6/S7 object that inherits from this class?
is_checking | Determine testing status
is_parallel | Determine testing status
is_snapshot | Determine testing status
is_testing | Determine testing status

## -- J --

JunitReporter | Report results in jUnit XML format

## -- L --

ListReporter | Capture test results and metadata
LlmReporter | Report test progress for LLMs
local_edition | Temporarily change the active testthat edition
local_mocked_bindings | Temporarily redefine function definitions
local_mocked_r6_class | Mock an R6 class
local_mocked_s3_method | Mock S3 and S4 methods
local_mocked_s4_method | Mock S3 and S4 methods
local_on_cran | Skip a test for various reasons
local_reproducible_output | Temporarily set options for maximum reproducibility
local_test_context | Temporarily set options for maximum reproducibility
LocationReporter | Test reporter: location
logical-expectations | Do you expect 'TRUE' or 'FALSE'?

## -- M --

MinimalReporter | Report minimal results as compactly as possible
mock_output_sequence | Mock a sequence of output from a function
MultiReporter | Run multiple reporters at the same time

## -- P --

ParallelProgressReporter | Report progress interactively
pass | Declare that an expectation either passes or fails
ProgressReporter | Report progress interactively

## -- R --

RStudioReporter | Report results to RStudio

## -- S --

set_state_inspector | Check for global state changes
show_failure | Test your custom expectations
SilentReporter | Silently collect and all expectations
skip | Skip a test for various reasons
skip_if | Skip a test for various reasons
skip_if_not | Skip a test for various reasons
skip_if_not_installed | Skip a test for various reasons
skip_if_offline | Skip a test for various reasons
skip_if_translated | Skip a test for various reasons
skip_on_bioc | Skip a test for various reasons
skip_on_ci | Skip a test for various reasons
skip_on_covr | Skip a test for various reasons
skip_on_cran | Skip a test for various reasons
skip_on_os | Skip a test for various reasons
skip_unless_r | Skip a test for various reasons
SlowReporter | Find slow tests
snapshot_accept | Accept or reject modified snapshots
snapshot_download_gh | Download snapshots from GitHub
snapshot_reject | Accept or reject modified snapshots
snapshot_review | Accept or reject modified snapshots
StopReporter | Error if any test fails
SummaryReporter | Report a summary of failures

## -- T --

TapReporter | Report results in TAP format
TeamcityReporter | Report results in Teamcity format
teardown_env | Run code after all test files
testing_package | Determine testing status
test_check | Run all tests in a package
test_dir | Run all tests in a directory
test_file | Run tests in a single file
test_local | Run all tests in a package
test_package | Run all tests in a package
test_path | Locate a file in the testing directory
test_that | Run a test
try_again | Evaluate an expectation multiple times until it succeeds

## -- U --

use_catch | Use Catch for C++ unit testing

## -- W --

with_mocked_bindings | Temporarily redefine function definitions