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-arm64)testthat_3.2.1.9000.tgz(r-4.4-x86_64)testthat_3.2.1.9000.tgz(r-4.3-arm64)testthat_3.2.1.9000.tgz(r-4.3-x86_64)
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

# Installtestthat 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

189 exports 867 stars 15.04 score 30 dependencies 2018 dependents 7 mentions 541.8k downloads

Last updated 5 months agofrom:f060ccec36

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_matchexpect_no_messageexpect_no_warningexpect_nullexpect_outputexpect_output_fileexpect_referenceexpect_s3_classexpect_s4_classexpect_setequalexpect_silentexpect_snapshotexpect_snapshot_errorexpect_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:briocallrclicrayondescdiffobjdigestevaluatefansifsgluejsonlitelifecyclemagrittrpillarpkgbuildpkgconfigpkgloadpraiseprocessxpsR6rematch2rlangrprojroottibbleutf8vctrswaldowithr

Custom expectations

Rendered fromcustom-expectation.Rmdusingknitr::rmarkdownon Jun 12 2024.

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

Running tests in parallel

Rendered fromparallel.Rmdusingknitr::rmarkdownon Jun 12 2024.

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

Skipping tests

Rendered fromskipping.Rmdusingknitr::rmarkdownon Jun 12 2024.

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

Snapshot tests

Rendered fromsnapshotting.Rmdusingknitr::rmarkdownon Jun 12 2024.

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

Special files

Rendered fromspecial-files.Rmdusingknitr::rmarkdownon Jun 12 2024.

Last update: 2024-02-13
Started: 2023-04-10

Test fixtures

Rendered fromtest-fixtures.Rmdusingknitr::rmarkdownon Jun 12 2024.

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

testthat 3e

Rendered fromthird-edition.Rmdusingknitr::rmarkdownon Jun 12 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 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 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
Does code return a vector with the expected size and/or prototype?expect_vector
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_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
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 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