[Rd] RUnit testing with R CMD check and more

Martin Morgan mtmorgan at fhcrc.org
Wed Sep 5 18:43:37 CEST 2007


Gorjanc,

One important scenario I use during development is to run selected
unit tests, typically found in a single file. Usually this is
preceeded by INSTALL rather than check, as I optimistically think that
my changes will be an improvement and hence installing the package is
a starting point for the next iteration.

(another) Martin

Gorjanc Gregor <Gregor.Gorjanc at bfro.uni-lj.si> writes:

> 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
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org



More information about the R-devel mailing list