[R] Is it possible to run unit tests after a package installation?

Juan Carlos Borrás jcborras at gmail.com
Thu Mar 31 23:45:25 CEST 2011


Dear all,
I'm deep into Chambers' SoDA and R-exts.html but I can't find all
answers. The thing is that I would like to run my unit tests right
after a package installation.
That is while the command "R CMD check <package_name>" runs all files
named <package_name>/tests/*.R (so unit tests can be placed there) I
wonder if it is possible to run them on some destination/target
machine after the package has been installed.
My goal is to enforce reliable results from calls to the package
functions independently on the machine the package is being installed.
 The only way I can come up with (and is not even close to a package
post-install check) is to place them in the directory where examples
can be show using the example() command. But
package_name/tests/Examples does not look as the place it should be
(or at least it does not work for me for the time being).
One of the difficulties I foresee also is how to state that my unit
test framework of choice (be RUnit or testthat depending on my mood)
is a dependency but not something that must be loaded before my
package does. That is, it must be installed in the system but it
should not be loaded.
Any hints or comments on the above will be highly appreciated.
Thanks in advance.
jcb!



More information about the R-help mailing list