tinytest
A lightweight, no-dependency, but full-featured package for unit testing in R
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
Repository
A lightweight, no-dependency, but full-featured package for unit testing in R
Basic Info
Statistics
- Stars: 232
- Watchers: 9
- Forks: 20
- Open Issues: 31
- Releases: 0
Metadata Files
README.md
tinytest 
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

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.
- You do not need to throw an error to discover that a test has failed. A boolean result is in principle enough.
- 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.
- 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
- Website: http://www.markvanderloo.eu
- Repositories: 49
- Profile: https://github.com/markvanderloo
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
Top Committers
| Name | 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
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
- Homepage: https://github.com/markvanderloo/tinytest
- Documentation: http://cran.r-project.org/web/packages/tinytest/tinytest.pdf
- License: GPL-3
-
Latest release: 1.4.1
published over 3 years ago
Rankings
Maintainers (1)
conda-forge.org: r-tinytest
- Homepage: https://github.com/markvanderloo/tinytest
- License: GPL-3.0-or-later
-
Latest release: 1.3.1
published about 5 years ago
Rankings
Dependencies
- R >= 3.0.0 depends
- parallel * imports
- utils * imports