testthat

An R 📦 to make testing 😀

https://github.com/r-lib/testthat

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • ✓
    .zenodo.json file
    Found .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • ✓
    Committers with academic emails
    11 of 135 committers (8.1%) from academic institutions
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (19.0%) to scientific vocabulary

Keywords

r unit-testing

Keywords from Contributors

package-creation tidy-data documentation-tool rmarkdown visualisation data-manipulation grammar latex csv book
Last synced: 6 months ago · JSON representation

Repository

An R 📦 to make testing 😀

Basic Info
Statistics
  • Stars: 906
  • Watchers: 19
  • Forks: 333
  • Open Issues: 8
  • Releases: 38
Topics
r unit-testing
Created over 16 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Code of conduct Codeowners

README.Rmd

---
output: github_document
---



```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

# testthat 


[![CRAN status](https://www.r-pkg.org/badges/version/testthat)](https://cran.r-project.org/package=testthat)
[![R-CMD-check](https://github.com/r-lib/testthat/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/testthat/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/r-lib/testthat/graph/badge.svg)](https://app.codecov.io/gh/r-lib/testthat)


## Overview

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

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

* Easily integrates in your existing workflow, whether it's informal testing
  on the command line, building test suites, or using R CMD check.

* Displays test progress visually, showing a pass, fail, or error for every
  expectation. If you're using the terminal or a recent version of RStudio,
  it'll even colour the output.

testthat draws inspiration from the xUnit family of testing packages, as well as from many of the innovative ruby testing libraries, like [rspec](https://rspec.info/), [testy](https://github.com/ahoward/testy), [bacon](https://github.com/leahneukirchen/bacon) and [cucumber](https://cucumber.io).

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

If you're not familiar with testthat, the [testing chapter](https://r-pkgs.org/testing-basics.html) in [R packages](https://r-pkgs.org) gives a good overview, along with workflow advice and concrete examples.

## Installation

```{r, eval = FALSE}
# Install the released version from CRAN
install.packages("testthat")

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

## Usage

The easiest way to get started is with [usethis](https://github.com/r-lib/usethis). Assuming you're in a package directory, just run `usethis::use_test("name")` to create a test file, and set up all the other infrastructure you need. If you're using RStudio, press Cmd/Ctrl + Shift + T (or run `devtools::test()` if not) to run all the tests in a package.

Owner

  • Name: R infrastructure
  • Login: r-lib
  • Kind: organization

GitHub Events

Total
  • Create event: 70
  • Release event: 2
  • Issues event: 214
  • Watch event: 23
  • Delete event: 77
  • Issue comment event: 317
  • Push event: 327
  • Pull request review comment event: 149
  • Pull request review event: 136
  • Pull request event: 173
  • Fork event: 18
Last Year
  • Create event: 70
  • Release event: 2
  • Issues event: 214
  • Watch event: 23
  • Delete event: 77
  • Issue comment event: 317
  • Push event: 327
  • Pull request review comment event: 149
  • Pull request review event: 136
  • Pull request event: 173
  • Fork event: 18

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 2,183
  • Total Committers: 135
  • Avg Commits per committer: 16.17
  • Development Distribution Score (DDS): 0.384
Past Year
  • Commits: 42
  • Committers: 8
  • Avg Commits per committer: 5.25
  • Development Distribution Score (DDS): 0.238
Top Committers
Name Email Commits
hadley h****m@g****m 1,344
Kirill Müller k****r@i****h 248
Lionel Henry l****y@g****m 105
Kevin Ushey k****y@g****m 74
Gábor Csárdi c****r@g****m 59
Jim Hester j****r@g****m 43
Kirill Müller k****r 39
Karl Forner K****r@q****m 30
Michael Chirico c****m@g****m 11
Neal Richardson n****l@c****o 10
Jennifer (Jenny) Bryan j****n@g****m 10
Dirk Schumacher m****l@d****t 10
Maëlle Salmon m****n@y****e 8
Salim B s****m@p****e 6
Craig Citro c****o@g****m 6
Michal Bojanowski m****2@g****m 6
Peter Meilstrup p****p@g****m 5
brodieG b****G 5
windelinckx n****x@h****m 5
Dan Keshet d****t@g****m 4
Jeff Allen j****n@t****t 4
Max Held i****o@m****e 3
Daniel Possenriede p****e@g****m 3
Hugo Gruson B****o 3
Karl Forner k****r@g****m 3
Mara Averick m****k@g****m 3
Davis Vaughan d****s@r****m 3
olivroy 5****y 3
Tomas Kalibera k****a@c****u 3
Romain François r****n@r****m 3
and 105 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 330
  • Total pull requests: 241
  • Average time to close issues: 8 months
  • Average time to close pull requests: 2 months
  • Total issue authors: 163
  • Total pull request authors: 40
  • Average comments per issue: 1.54
  • Average comments per pull request: 0.79
  • Merged pull requests: 154
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 99
  • Pull requests: 123
  • Average time to close issues: 27 days
  • Average time to close pull requests: 4 days
  • Issue authors: 55
  • Pull request authors: 18
  • Average comments per issue: 0.35
  • Average comments per pull request: 0.49
  • Merged pull requests: 68
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • hadley (64)
  • MichaelChirico (19)
  • jennybc (11)
  • DanChaltiel (10)
  • kevinushey (7)
  • lionel- (6)
  • olivroy (5)
  • krlmlr (5)
  • maelle (5)
  • DavisVaughan (5)
  • pawelru (5)
  • kubajal (4)
  • fh-mthomson (4)
  • moodymudskipper (3)
  • aronatkins (3)
Pull Request Authors
  • hadley (136)
  • MichaelChirico (11)
  • gaborcsardi (10)
  • kevinushey (9)
  • lionel- (7)
  • olivroy (6)
  • maelle (4)
  • kubajal (4)
  • jonthegeek (4)
  • stibu81 (2)
  • mcol (2)
  • atheriel (2)
  • m-muecke (2)
  • jeroen (2)
  • tylermorganwall (2)
Top Labels
Issue Labels
feature (57) bug (31) snapshot :camera: (30) expectation :scream_cat: (20) documentation (14) skip (9) parallel ⇶ (9) conditions (7) tests :blue_book: (7) reporter :memo: (6) upkeep (4) reprex (4) mocking :bird: (3) 3e :books: (2) BDD :teacher: (2) fixtures :factory: (2) help wanted :heart: (1) breaking change :skull_and_crossbones: (1)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 1,152,157 last-month
  • Total docker downloads: 128,558,516
  • Total dependent packages: 8,699
    (may contain duplicates)
  • Total dependent repositories: 35,781
    (may contain duplicates)
  • Total versions: 104
  • Total maintainers: 1
cran.r-project.org: testthat

Unit Testing for R

  • Versions: 48
  • Dependent Packages: 8,675
  • Dependent Repositories: 35,710
  • Downloads: 1,152,157 Last month
  • Docker Downloads: 128,558,516
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Forks count: 0.1%
Stargazers count: 0.3%
Downloads: 0.4%
Average: 3.0%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: r-testthat
  • Versions: 19
  • Dependent Packages: 24
  • Dependent Repositories: 71
Rankings
Dependent packages count: 2.8%
Average: 3.5%
Dependent repos count: 4.1%
Last synced: 6 months ago
proxy.golang.org: github.com/r-lib/testthat
  • Versions: 37
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.5%
Average: 6.7%
Dependent repos count: 6.9%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • rlang * imports
  • testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
tests/testthat/test-parallel/crash/DESCRIPTION cran
  • testthat * suggests
tests/testthat/test-parallel/ok/DESCRIPTION cran
  • testthat * suggests
tests/testthat/test-parallel/outside/DESCRIPTION cran
  • testthat * suggests
tests/testthat/test-parallel/setup/DESCRIPTION cran
  • testthat * suggests
tests/testthat/test-parallel/startup/DESCRIPTION cran
  • testthat * suggests
tests/testthat/test-parallel/teardown/DESCRIPTION cran
  • testthat * suggests
tests/testthat/testConfigLoadAll/DESCRIPTION cran
  • rlang * imports
  • testthat >= 3.0.0 suggests
tests/testthat/test-parallel/fail/DESCRIPTION cran
  • testthat * suggests
tests/testthat/test-parallel/snap/DESCRIPTION cran
  • testthat * suggests