This package provides support for randomized software testing for R. Inspired by its influential Haskell namesake, it promotes a style of writing tests where assertions about functions are verified on random inputs. The package provides default generators for most common types but allows users to modify their behavior or even to create new ones based on the needs of a each application. The main advantages over traditional testing are
- Each test can be run many times, with better coverage and bug detection.
- Tests can be run on large inputs that would be unwieldy to include in the test source or would require addtional development.
- Assertions are more self-documenting than individual examples of the I/O relation, and in some instances can amount to a complete specification for a function.
- The developer is less likely to incorporate unstated assumptions in the choice of test inputs.
Additional features include the repro
function that supports reproducing and debugging a failed test. For additional information, see the tutorial. For support, we are monitoring tags [R] [quickcheck] on Stackoverflow. Please remember to add both tags to your question. For new releases, subscribe to quickcheck
's Release notes feed or by email
To install the latest release and its dependencies, enter the following expression:
install.packages("quickcheck", repos = c("http://archive.rzilla.org", unlist(options("repos"))))
The current version is 3.5.0 .
While this package was first developed to support the development of the rmr2
package, its usefulness goes beyond it, big data or rzilla. In fact, it is meant to help writing tests for any R package.