Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An R 📦 to make testing 😀

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

r-lib/testthat

Repository files navigation

CRAN statusR-CMD-checkCodecov test coverage

Overview

Testing your code can be painful and tedious, but it greatly increasesthe quality of your code.testthat tries to make testing as fun aspossible, so that you get a visceral satisfaction from writing tests.Testing should be addictive, so you do it all the time. To make thathappen, testthat:

  • Provides functions that make it easy to describe what you expect afunction to do, including catching errors, warnings, and messages.

  • Easily integrates in your existing workflow, whether it’s informaltesting on the command line, building test suites, or using R CMDcheck.

  • Displays test progress visually, showing a pass, fail, or error forevery expectation. If you’re using the terminal or a recent version ofRStudio, it’ll even colour the output.

testthat draws inspiration from the xUnit family of testing packages, aswell as from many of the innovative ruby testing libraries, likerspec,testy,bacon andcucumber.

testthat is the most popular unit testing package for R and is used bythousands of CRAN packages.

If you’re not familiar with testthat, thetestingchapter inRpackages gives a good overview, along with workflowadvice and concrete examples.

Installation

# Install the released version from CRANinstall.packages("testthat")# Or the development version from GitHub:# install.packages("pak")pak::pak("r-lib/testthat")

Usage

The easiest way to get started is withusethis. Assuming you’re in apackage directory, just runusethis::use_test("name") to create a testfile, and set up all the other infrastructure you need. If you’re usingRStudio, press Cmd/Ctrl + Shift + T (or rundevtools::test() if not)to run all the tests in a package.

About

An R 📦 to make testing 😀

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Contributors135

Languages


[8]ページ先頭

©2009-2025 Movatter.jp