Package: testthat 3.2.1.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.1.9000.tar.gz
testthat_3.2.1.9000.zip(r-4.5)testthat_3.2.1.9000.zip(r-4.4)testthat_3.2.1.9000.zip(r-4.3)
testthat_3.2.1.9000.tgz(r-4.4-x86_64)testthat_3.2.1.9000.tgz(r-4.4-arm64)testthat_3.2.1.9000.tgz(r-4.3-x86_64)testthat_3.2.1.9000.tgz(r-4.3-arm64)
testthat_3.2.1.9000.tar.gz(r-4.5-noble)testthat_3.2.1.9000.tar.gz(r-4.4-noble)
testthat_3.2.1.9000.tgz(r-4.4-emscripten)testthat_3.2.1.9000.tgz(r-4.3-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'))

Peer review:

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

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

On CRAN:

unit-testing

20.78 score 890 stars 444 packages 70k scripts 432k downloads 7 mentions 193 exports 23 dependencies

Last updated 10 days agofrom:886527dcdf. Checks:OK: 8 NOTE: 1. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 07 2024
R-4.5-win-x86_64NOTENov 07 2024
R-4.5-linux-x86_64OKNov 07 2024
R-4.4-win-x86_64OKNov 07 2024
R-4.4-mac-x86_64OKNov 07 2024
R-4.4-mac-aarch64OKNov 07 2024
R-4.3-win-x86_64OKNov 07 2024
R-4.3-mac-x86_64OKNov 07 2024
R-4.3-mac-aarch64OKNov 07 2024

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_conditionexpect_containsexpect_cpp_tests_passexpect_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_referenceexpect_s3_classexpect_s4_classexpect_s7_classexpect_setequalexpect_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_falseis_identical_tois_informative_erroris_less_thanis_more_thanis_nullis_parallelis_snapshotis_testingis_trueis.expectationitJunitReporterListReporterlocal_editionlocal_mocklocal_mocked_bindingslocal_reproducible_outputlocal_snapshotterlocal_test_contextlocal_test_directoryLocationReportermake_expectationmatchesMinimalReporterMultiReporternew_expectationnotParallelProgressReporterprints_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_travissnapshot_acceptsnapshot_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:briocallrclicrayondescdiffobjdigestevaluatefsgluejsonlitelifecyclemagrittrpkgbuildpkgloadpraiseprocessxpsR6rlangrprojrootwaldowithr

Custom expectations

Rendered fromcustom-expectation.Rmdusingknitr::rmarkdownon Nov 07 2024.

Last update: 2023-04-10
Started: 2017-10-12

Running tests in parallel

Rendered fromparallel.Rmdusingknitr::rmarkdownon Nov 07 2024.

Last update: 2023-09-22
Started: 2020-07-23

Skipping tests

Rendered fromskipping.Rmdusingknitr::rmarkdownon Nov 07 2024.

Last update: 2023-04-05
Started: 2020-07-23

Snapshot tests

Rendered fromsnapshotting.Rmdusingknitr::rmarkdownon Nov 07 2024.

Last update: 2023-07-26
Started: 2020-07-16

Special files

Rendered fromspecial-files.Rmdusingknitr::rmarkdownon Nov 07 2024.

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

Test fixtures

Rendered fromtest-fixtures.Rmdusingknitr::rmarkdownon Nov 07 2024.

Last update: 2024-02-13
Started: 2020-07-14

testthat 3e

Rendered fromthird-edition.Rmdusingknitr::rmarkdownon Nov 07 2024.

Last update: 2023-04-06
Started: 2020-07-12

Readme and manuals

Help Manual

Help pageTopics
Watches code and tests for changes, rerunning tests as appropriate.auto_test
Watches a package for changes, rerunning tests as appropriate.auto_test_package
Check reporter: 13 line summary of problemsCheckReporter
Does code return a number greater/less than the expected value?comparison-expectations expect_gt expect_gte expect_lt expect_lte
Test reporter: start recovery.DebugReporter
describe: a BDD testing languagedescribe it
Does code return the expected value?equality-expectations expect_equal expect_identical
The building block of all 'expect_' functionsexpect
Does code throw an error, warning, message, or other condition?expect_condition expect_error expect_message expect_warning
Does code return a visible or invisible object?expect_invisible expect_visible
Does code return a vector with the specified length?expect_length
Does a string match a regular expression?expect_match expect_no_match
Does code return a vector with (given) names?expect_named
Does code run without error, warning, message, or other condition?expect_no_condition expect_no_error expect_no_message expect_no_warning
Does code return 'NULL'?expect_null
Does code print output to the console?expect_output
Does code return a vector containing the expected values?expect_contains expect_in expect_mapequal expect_setequal
Does code execute silently?expect_silent
Snapshot testingexpect_snapshot
Snapshot testing for whole filesannounce_snapshot_file compare_file_binary compare_file_text expect_snapshot_file
Snapshot testing for valuesexpect_snapshot_value
Tools for testing expectationsexpect_failure expect_no_failure expect_no_success expect_snapshot_failure expect_success show_failure
Does code return a vector with the expected size and/or prototype?expect_vector
Construct an expectation objectexpectation exp_signal is.expectation new_expectation
Default expectations that always succeed or fail.fail succeed
Test reporter: fail at end.FailReporter
Does code return an object inheriting from the expected base type, S3 class, or S4 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
Test reporter: summary of errors in jUnit XML format.JunitReporter
List reporter: gather all test results along with elapsed time and file information.ListReporter
Temporarily change the active testthat editionedition_get local_edition
Mocking toolslocal_mocked_bindings with_mocked_bindings
Locally set options for maximal test reproducibilitylocal_reproducible_output local_test_context
Test reporter: locationLocationReporter
Does code return 'TRUE' or 'FALSE'?expect_false expect_true logical-expectations
Test reporter: minimal.MinimalReporter
Multi reporter: combine several reporters in one.MultiReporter
Test reporter: interactive progress bar of errors.CompactProgressReporter ParallelProgressReporter ProgressReporter
Test reporter: RStudioRStudioReporter
State inspectedset_state_inspector
Test reporter: gather all errors silently.SilentReporter
Skip a testskip 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
Snapshot managementsnapshot_accept snapshot_review
Test reporter: stop on errorStopReporter
Test reporter: summary of errors.SummaryReporter
Test reporter: TAP format.TapReporter
Test reporter: Teamcity format.TeamcityReporter
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
Use Catch for C++ Unit Testinguse_catch