[Rd] RUnit testing with R CMD check and more (was: R CMD check recursive copy of tests/)
Gorjanc Gregor
Gregor.Gorjanc at bfro.uni-lj.si
Wed Sep 5 18:32:51 CEST 2007
Hello!
I have looked at Martin's recent work on "merging" unit tests with R CMD check,
fused it with my and Tony's contributions and developed it a bit further. Take
a look into the attached demo package on how it works.
In essence:
PKG/inst/RUnitTests
|- runRUnitTests.R (script to run RUnit tests)
\- ... (any RUnit test file)
PKG/R/runRUnitTests.R (wrapper function to call PKG/inst/RUnitTests/runRUnitTests.R)
PKG/man/runRUnitTests.Rd (help with examples! section)
The following can be achieved:
* useRs can run RUnit tests from within R after the package has been installed
on their machine - this info is also given in PKG-package.Rd file to encourage
useRs to test the package
* developeRs can run RUnit tests with:
- R CMD check since examples in PKG/man/runRUnitTests.Rd are tested to work
(test failures or R errors stop the R CMD check!)
- launcing the script PKG/inst/RUnitTests/runRUnitTests.R with Rscript or
R CMD check
I would like to hear any critiques, comments, suggestions, ... on above. Martin
mentioned (privately) that filenames have to much upper case letter, but I wanted
to emphasize that the main work is being done by RUnit package - not developed by
me!
Finnally, I would like to argue that from useRs point of view test and unit test
are the same thing and I believe that R would benefit if *all* tests could be
available in similar manner as above. This of course calls for the modification of
packaging, testing, etc., but could provide more feedback (sure some of it will be
bogous) on testing on various configurations.
With regards, Gregor
More information about the R-devel
mailing list