Package: testthat 3.2.3.9000

Hadley Wickham

testthat: Unit Testing for R

Software testing is important, but, in part because it is frustrating and boring, many of us avoid it. 'testthat' is a testing framework for R that is easy to learn and use, and integrates with your existing 'workflow'.

Authors:Hadley Wickham [aut, cre], Posit Software, PBC [cph, fnd], R Core team [ctb]

testthat_3.2.3.9000.tar.gz
testthat_3.2.3.9000.zip(r-4.6)testthat_3.2.3.9000.zip(r-4.5)testthat_3.2.3.9000.zip(r-4.4)
testthat_3.2.3.9000.tgz(r-4.5-x86_64)testthat_3.2.3.9000.tgz(r-4.5-arm64)testthat_3.2.3.9000.tgz(r-4.4-x86_64)testthat_3.2.3.9000.tgz(r-4.4-arm64)
testthat_3.2.3.9000.tar.gz(r-4.6-arm64)testthat_3.2.3.9000.tar.gz(r-4.6-x86_64)testthat_3.2.3.9000.tar.gz(r-4.5-arm64)testthat_3.2.3.9000.tar.gz(r-4.5-x86_64)
testthat_3.2.3.9000.tgz(r-4.5-emscripten)
testthat.pdf |testthat.html
testthat/json (API)
NEWS

# Install 'testthat' in R:
install.packages('testthat', repos = c('https://r-lib.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/r-lib/testthat/issues

Pkgdown/docs site:https://testthat.r-lib.org

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

unit-testingcpp

21.83 score 915 stars 479 packages 77k scripts 1.2M downloads 7 mentions 205 exports 22 dependencies

Last updated from:10b328b7ee. Checks:11 ERROR, 2 OK. Indexed: yes.

TargetResultTotal timeArtifact
linux-devel-arm64ERROR170
linux-devel-x86_64ERROR194
source / vignettesOK337
linux-release-arm64ERROR165
linux-release-x86_64ERROR195
macos-release-arm64ERROR211
macos-release-x86_64ERROR342
macos-oldrel-arm64ERROR127
macos-oldrel-x86_64ERROR365
windows-develERROR237
windows-releaseERROR227
windows-oldrelERROR261
wasm-releaseOK130

Exports:%>%announce_snapshot_fileauto_testauto_test_packagecapture_conditioncapture_errorcapture_expectationcapture_messagecapture_messagescapture_outputcapture_output_linescapture_warningcapture_warningscheck_reporterCheckReporterCompactProgressReportercomparecompare_file_binarycompare_file_textcontextcontext_start_fileDebugReporterdefault_compact_reporterdefault_parallel_reporterdefault_reporterdescribeedition_getequalsequals_referenceevaluate_promiseexp_signalexpectexpect_all_equalexpect_all_falseexpect_all_trueexpect_conditionexpect_containsexpect_cpp_tests_passexpect_disjointexpect_equalexpect_equal_to_referenceexpect_equivalentexpect_errorexpect_failureexpect_falseexpect_gtexpect_gteexpect_identicalexpect_inexpect_invisibleexpect_isexpect_known_hashexpect_known_outputexpect_known_valueexpect_lengthexpect_less_thanexpect_ltexpect_lteexpect_mapequalexpect_matchexpect_messageexpect_more_thanexpect_namedexpect_no_conditionexpect_no_errorexpect_no_failureexpect_no_matchexpect_no_messageexpect_no_successexpect_no_warningexpect_nullexpect_outputexpect_output_fileexpect_r6_classexpect_referenceexpect_s3_classexpect_s4_classexpect_s7_classexpect_setequalexpect_shapeexpect_silentexpect_snapshotexpect_snapshot_errorexpect_snapshot_failureexpect_snapshot_fileexpect_snapshot_outputexpect_snapshot_valueexpect_snapshot_warningexpect_successexpect_thatexpect_trueexpect_typeexpect_vectorexpect_visibleexpect_warningexpectationfailFailReporterfind_test_scriptsget_reportergives_warninghas_namesis_ais_checkingis_equivalent_tois_identical_tois_informative_erroris_less_thanis_more_thanis_parallelis_snapshotis_testingis.expectationitJunitReporterListReporterlocal_editionlocal_mocklocal_mocked_bindingslocal_mocked_r6_classlocal_mocked_s3_methodlocal_mocked_s4_methodlocal_on_cranlocal_reproducible_outputlocal_snapshotterlocal_test_contextlocal_test_directoryLocationReportermake_expectationMinimalReportermock_output_sequenceMultiReporternew_expectationnotParallelProgressReporterpassprints_textProgressReporterquasi_labelReporterRStudioReporterrun_cpp_testsset_max_failsset_reporterset_state_inspectorsetupshow_failureshows_messageSilentReporterskipskip_ifskip_if_notskip_if_not_installedskip_if_offlineskip_if_translatedskip_on_appveyorskip_on_biocskip_on_ciskip_on_covrskip_on_cranskip_on_osskip_on_travisskip_unless_rSlowReportersnapshot_acceptsnapshot_download_ghsnapshot_rejectsnapshot_reviewsource_dirsource_filesource_test_helperssource_test_setupsource_test_teardownStopReportersucceedSummaryReportertakes_less_thanTapReporterTeamcityReporterteardownteardown_envtest_checktest_dirtest_envtest_exampletest_examplestest_filetest_localtest_packagetest_pathtest_rdtest_thattesting_packagetestthat_exampletestthat_examplestestthat_printtestthat_tolerancethrows_errortry_againuse_catchverify_outputwatchwith_mockwith_mocked_bindingswith_reporter

Dependencies:briocallrclicrayondescdiffobjevaluatefsgluejsonlitelifecyclemagrittrpkgbuildpkgloadpraiseprocessxpsR6rlangrprojrootwaldowithr

Custom expectations

Rendered fromcustom-expectation.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2025-10-06
Started: 2017-10-12

Mocking

Rendered frommocking.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2025-09-05
Started: 2025-09-05

Running tests in parallel

Rendered fromparallel.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2025-08-04
Started: 2020-07-23

Skipping tests

Rendered fromskipping.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2025-09-05
Started: 2020-07-23

Snapshot tests

Rendered fromsnapshotting.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2025-09-05
Started: 2020-07-16

Special files

Rendered fromspecial-files.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2024-08-23
Started: 2023-04-10

Test fixtures

Rendered fromtest-fixtures.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2025-09-05
Started: 2020-07-14

Testing challenging functions

Rendered fromchallenging-tests.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2025-10-02
Started: 2025-09-05

testthat 3e

Rendered fromthird-edition.Rmdusingknitr::rmarkdownon Oct 23 2025.

Last update: 2025-10-02
Started: 2020-07-12

Readme and manuals

Help Manual

Help pageTopics
Report results for R CMD checkCheckReporter
Do you expect a number bigger or smaller than this?comparison-expectations expect_gt expect_gte expect_lt expect_lte
Interactively debug failing testsDebugReporter
Do you expect this value?equality-expectations expect_equal expect_identical
Do you expect every value in a vector to have this value?expect_all_equal expect_all_false expect_all_true
Do you expect an error, warning, message, or other condition?expect_condition expect_error expect_message expect_warning
Do you expect the result to be (in)visible?expect_invisible expect_visible
Do you expect an object with this length or shape?expect_length expect_shape
Do you expect a string to match this pattern?expect_match expect_no_match
Do you expect a vector with (these) names?expect_named
Do you expect the absence of errors, warnings, messages, or other conditions?expect_no_condition expect_no_error expect_no_message expect_no_warning
Do you expect 'NULL'?expect_null
Do you expect printed output to match this pattern?expect_output
Do you expect a vector containing these values?expect_contains expect_disjoint expect_in expect_mapequal expect_setequal
Do you expect code to execute silently?expect_silent
Do you expect this code to run the same way as last time?expect_snapshot
Do you expect this code to create the same file as last time?announce_snapshot_file compare_file_binary compare_file_text expect_snapshot_file
Do you expect this code to return the same value as last time?expect_snapshot_value
Test your custom expectationsexpect_failure expect_snapshot_failure expect_success show_failure
Do you expect a vector with this size and/or prototype?expect_vector
Declare that an expectation either passes or failsfail pass
Fail if any tests failFailReporter
Do you expect an S3/S4/R6/S7 object that inherits from this class?expect_r6_class expect_s3_class expect_s4_class expect_s7_class expect_type inheritance-expectations
Determine testing statusis_checking is_parallel is_snapshot is_testing testing_package
Report results in jUnit XML formatJunitReporter
Capture test results and metadataListReporter
Temporarily change the active testthat editionedition_get local_edition
Temporarily redefine function definitionslocal_mocked_bindings with_mocked_bindings
Mock an R6 classlocal_mocked_r6_class
Mock S3 and S4 methodslocal_mocked_s3_method local_mocked_s4_method
Temporarily set options for maximum reproducibilitylocal_reproducible_output local_test_context
Test reporter: locationLocationReporter
Do you expect 'TRUE' or 'FALSE'?expect_false expect_true logical-expectations
Report minimal results as compactly as possibleMinimalReporter
Mock a sequence of output from a functionmock_output_sequence
Run multiple reporters at the same timeMultiReporter
Report progress interactivelyCompactProgressReporter ParallelProgressReporter ProgressReporter
Report results to RStudioRStudioReporter
Check for global state changesset_state_inspector
Silently collect and all expectationsSilentReporter
Skip a test for various reasonslocal_on_cran skip skip_if skip_if_not skip_if_not_installed skip_if_offline skip_if_translated skip_on_bioc skip_on_ci skip_on_covr skip_on_cran skip_on_os skip_unless_r
Find slow testsSlowReporter
Accept or reject modified snapshotssnapshot_accept snapshot_reject snapshot_review
Download snapshots from GitHubsnapshot_download_gh
Error if any test failsStopReporter
Report a summary of failuresSummaryReporter
Report results in TAP formatTapReporter
Report results in Teamcity formatTeamcityReporter
Run code after all test filesteardown_env
Run all tests in a directorytest_dir
Run tests in a single filetest_file
Run all tests in a packagetest_check test_local test_package
Locate a file in the testing directorytest_path
Run a testtest_that
Evaluate an expectation multiple times until it succeedstry_again
Use Catch for C++ unit testinguse_catch