Juan Carlos BorrĂ¡s
2011-Mar-31 21:45 UTC
[R] Is it possible to run unit tests after a package installation?
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!