1 min read

# Automatic Testing

I believe it is important to improve the reliability of R programming. Packages such as testthat help with this, but these packages aren’t comprehensive enough. What I would like it more automatic testing. In some packages, univariateML being a great example, there are a lot of functions following the same basic prototype: Every function has the same formals and they return similar objects. What I would like is to specify the prototype and automatically check that each of the approximately 25 functions in univariateML adheres to it.

This prototype does not have to be the same for each function but can depend on attributes. Anyhow, in the univariateML case, I want at least the following to be true:

• Each function has the same input checker, and the input checker works well. It depends on an attribute that specifies the domain of the function.
• Every function has the same formals: c(x, na.rm, ...). This is pretty easy to check.
• Every function reliably calculates what it is supposed to, and gives informative error messages.

The thing is, it is both time-consuming and difficult to program all of this reliably for every function by copy-pasting tests. That is why the generation of tests should be automatic.