tinytest

A lightweight, no-dependency, but full-featured package for unit testing in R

https://github.com/markvanderloo/tinytest

Science Score: 23.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
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 15 committers (6.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.6%) to scientific vocabulary

Keywords from Contributors

tidy-data devtools hash-digest rcpp data-manipulation grammar rmarkdown matrix parallelization tidyverse
Last synced: 10 months ago · JSON representation

Repository

A lightweight, no-dependency, but full-featured package for unit testing in R

Basic Info
  • Host: GitHub
  • Owner: markvanderloo
  • License: gpl-3.0
  • Language: R
  • Default Branch: master
  • Homepage:
  • Size: 857 KB
Statistics
  • Stars: 232
  • Watchers: 9
  • Forks: 20
  • Open Issues: 31
  • Releases: 0
Created over 7 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

CRAN status Downloads

tinytest tinytest has no logo

A lightweight, no-dependency, full-featured package for unit testing

Overview of functionality, or Watch my talk at useR!2021

Installing tinytest

From CRAN

In R, do r install.packages("tinytest")

From GitHub

In your (bash) shell, do

bash git clone https://github.com/markvanderloo/tinytest cd tinytest make install

onwards to the tinyverse

tinytest philosophy.

Testing should be as easy as possible.

Testing infrastructure must not get in the way of the developer. Setting up tests should be done with ease. In tinytest tests are simple R-scripts where test statements can be interspersed with other code (e.g. to prepare some results for testing).

Test results are data

The purpose of testing is to gather evidence (data) that builds confidence in the quality of software. Unit tests consist of expressions where an expected result is compared with the result of a program or function. For example:

```r addOne <- function(x) x + 1 subOne <- function(x) x - 2

this test should pass

tinytest::expect_equal(addOne(1), 2 )

this test will fail

tinytest::expect_equal(subOne(2), 1 ) ```

Some unit testing frameworks for R throw a formal exception (error) whenever a test fails. There are several reasons why this is not a good idea.

  1. You do not need to throw an error to discover that a test has failed. A boolean result is in principle enough.
  2. A traceback of the error does not give you any information on the cause of the test failure. This is because the test function throws the error, not the tested code.
  3. Throwing errors complicates the code needed for developing a testing suite, making testing suites harder to maintain and possibly more complex to use than necessary.

tinytest therefore treats test results as data, not as exceptions. This data can be summarized and investigated by any method you already know in R.

Error on deploy

There is a case where the failure of a test should cause an error, namely when testing for deployment (e.g. publishing a package on CRAN). Therefore, when running R CMD check, an error will be thrown if a test has failed. This way the error interrupts the deployment process instead of the testing process.

Run all tests

By default all tests are run and the results are summarized to one line of output per failed test.

Tests are installed with the package

So a package author can request test results from users that installed the package.

Show you what you need

Developing and debugging takes focus and often deep concentration. tinytest supports your workflow by directing you as quickly as possible to the source of the test failure. In a single line of output you get the test result, the file and location in the file, and the test call that failed. Of course, printing is configurable through options.

Light weight is the right weight

Keep it simple, keep it clean. See tinyverse.org.

Owner

  • Name: Mark van der Loo
  • Login: markvanderloo
  • Kind: user
  • Location: Netherlands
  • Company: Statistics Netherlands | Tridata

math, programming, data

GitHub Events

Total
  • Issues event: 3
  • Watch event: 10
  • Issue comment event: 19
  • Push event: 1
  • Pull request event: 3
Last Year
  • Issues event: 3
  • Watch event: 10
  • Issue comment event: 19
  • Push event: 1
  • Pull request event: 3

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 413
  • Total Committers: 15
  • Avg Commits per committer: 27.533
  • Development Distribution Score (DDS): 0.07
Past Year
  • Commits: 6
  • Committers: 3
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
Mark van der Loo m****o@g****m 384
Matthijs S. Berends 3****s 7
Sebastian Meyer s****r@f****e 5
Dirk Eddelbuettel e****d@d****g 5
Salim B s****m@p****e 2
Artem Klevtsov a****v@g****m 1
Christoph Stepper c****r@m****m 1
Henrik Bengtsson hb@a****g 1
Joshua Ulrich j****h@g****m 1
TFcfgo t****s@c****e 1
Tim Taylor t****r@h****k 1
Vincent Arel-Bundock v****k@u****a 1
jangorecki j****i@w****l 1
Avraham Adler a****r 1
HughParsonage h****e@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 94
  • Total pull requests: 28
  • Average time to close issues: 27 days
  • Average time to close pull requests: 28 days
  • Total issue authors: 52
  • Total pull request authors: 14
  • Average comments per issue: 3.22
  • Average comments per pull request: 1.43
  • Merged pull requests: 25
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 3
  • Average time to close issues: 1 day
  • Average time to close pull requests: about 4 hours
  • Issue authors: 4
  • Pull request authors: 2
  • Average comments per issue: 0.25
  • Average comments per pull request: 0.67
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mllg (8)
  • eddelbuettel (6)
  • BartJanvanRossum (5)
  • HenrikBengtsson (5)
  • LiNk-NY (4)
  • grantmcdermott (3)
  • otoomet (3)
  • markvanderloo (3)
  • bryanhanson (3)
  • etiennebacher (2)
  • lindeloev (2)
  • joshuaulrich (2)
  • TimTaylor (2)
  • telegott (2)
  • JamesThompsonC (2)
Pull Request Authors
  • bastistician (7)
  • eddelbuettel (6)
  • msberends (3)
  • TimTaylor (2)
  • HughParsonage (1)
  • HenrikBengtsson (1)
  • joshuaulrich (1)
  • cstepper (1)
  • vincentarelbundock (1)
  • jangorecki (1)
  • aadler (1)
  • artemklevtsov (1)
  • rfhb (1)
  • thfuchs (1)
Top Labels
Issue Labels
enhancement (17) question (12) bug (4) wontfix (3) Doc improvement (2) duplicate (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 30,327 last-month
  • Total docker downloads: 46,673
  • Total dependent packages: 305
    (may contain duplicates)
  • Total dependent repositories: 677
    (may contain duplicates)
  • Total versions: 16
  • Total maintainers: 1
cran.r-project.org: tinytest

Lightweight and Feature Complete Unit Testing Framework

  • Versions: 13
  • Dependent Packages: 304
  • Dependent Repositories: 677
  • Downloads: 30,327 Last month
  • Docker Downloads: 46,673
Rankings
Dependent packages count: 0.4%
Dependent repos count: 0.5%
Stargazers count: 2.0%
Forks count: 3.5%
Downloads: 3.6%
Average: 5.4%
Docker downloads count: 22.7%
Maintainers (1)
Last synced: 10 months ago
conda-forge.org: r-tinytest
  • Versions: 3
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Stargazers count: 24.1%
Dependent packages count: 28.8%
Average: 30.6%
Dependent repos count: 34.0%
Forks count: 35.4%
Last synced: 10 months ago

Dependencies

pkg/DESCRIPTION cran
  • R >= 3.0.0 depends
  • parallel * imports
  • utils * imports