Automatic mutation testing of R packages. Mutation in the sense of mutating inputs (parameters) to function calls, rather than mutation of underlying code (see, for example, mutant for that). autotest primarily works by scraping documented examples for all functions, and mutating the parameters input to those functions.

This package is very unstable and subject to ongoing development (Oct 2020)

Installation

Not yet on CRAN, so must be installed from remote repository host systems using any one of the following options:

The package can then be loaded the usual way:

Usage

The simply way to use the package is

The argument to autotest_package() can either be the name of an installed package, or a path to a local directory containing the source for a package. The result is a data.frame of errors, warnings, and other diagnostic messages issued during package auotest-ing.

What gets tested?

The package is primarily intended to test packages and functions intended to process data, with data suitable for input into functions within a package specified in the autotest.yaml template. Other types of packages, such as those which provide access to data, will not be effectively tested by autotest. Standard tests include translation, substitution, and manipulation of classes and attributes of most standard one- and two-dimensional forms for representing data in R.

Prior work

  1. The great-expectations framework for python, described in this medium article.
  2. QuickCheck for Haskell
  3. mutate for ruby.