unittest-package: TAP-compliant Unit Testing

Description Details Author(s) References See Also


Concise TAP-compliant unit testing package. Authored unit tests can be run using R CMD check with minimal implementation overhead. If you want more features there are other unit testing packages (see 'See Also').


The unittest package provides two functions, ok and ok_group. The ok function prints ok when the expression provided evaluates to TRUE and prints not ok if the expression evaluates to anything else or results in a runtime error; this is the TAP format (http://testanything.org/) for reporting test results. The ok_group function is a convenience function for grouping related unit tests and produces TAP compliant comments in the output to separate the unit test groups.

A unit test summary is produced at the end of a session when a set of unit tests are run in non-interactive mode, for example when the unit tests are run using Rscript or by R CMD check. For using with R CMD check, see ‘I'm writing a package, how do I put tests in it?’.

For a list of all documentation use library(help="unittest"). Good places to start are the ‘Getting Started’ and ‘FAQ’vignettes. You can see these by typing vignette('getting_started', package='unittest') and vignette('faq', package='unittest') respectively.


Maintainer: Jamie Lentin <[email protected]>, Anthony Hennessey <[email protected]>.


Inspired by Perl's Test::Simple (http://search.cpan.org/perldoc?Test::Simple).

See Also

testthat, RUnit, svUnit.

unittest documentation built on Nov. 17, 2017, 4:30 a.m.