Skip to content
Prev 168867 / 398503 Next

Test Driven Development in R

Hello,

As Jose noted, svUnit is fully functional. It is completely written and 
has recently entered in beta stage. It will be released on CRAN (GPL >= 
2) at the end of the beta test, lasting in October 2009.

svUnit R package is independent from the SciViews GUI, but it is true 
there is also a GUI for test-driven development (TDD) in R using svUnit 
+ SciViews-K + Komodo, and it works on Linux/Windows/Mac OS X. It is 
probably the first one available for R. I am pretty sure other people 
will release similar tools for Eclipse/StatET and for Emacs/ESS soon. 
The GUI for TDD on top of svUnit depends on SciViews packages that are 
in mixed states: some are already on CRAN (svMisc, svSocket, svGUI, 
svIDE), while others, like svUnit or svTools are still in, respectively, 
beta and alpha stages. You can install them right now from r-forge only. 
Use:

 > install.packages("svUnit", repos="http://R-Forge.R-project.org")

in R to install svUnit. On Mac OS X, if R cannot find the binaries, make:

 > install.packages("svUnit", repos="http://R-Forge.R-project.org",
+     type = "source")

I want to remind also that svUnit is "test code compatible" with RUnit. 
Understand: you can use the same test units both with RUnit and with 
svUnit (but not simultaneously, of course). I think both packages have 
strengths. RUnit has (experimental) functions to check code coverage of 
the tests, while svUnit is much more flexible to define the tests: they 
can be attached to R objects, on memory, or on a .R file, they can be 
independent objects, and of course, they can also be contained in test 
suite on disk files, like for Runit. Also, svUnit proposes a mechanism 
to automatically locate tests, test units and test suites. It also 
proposes a central logging feature collecting test results from 
different test runs, and it fully integrates with the R CMD check 
mechanism of R for packages checking. Finally, svUnit reports can be 
pretty formatted using creole wiki language and be integrated in wikis 
(like http://wiki.r-project.org), say for automatic nightly test of your 
code. See page 9 of the svUnit vignette for an example.

It is this additional flexibility that is exploited in the GUI part for 
TDD in SciViews-K. There is a vignette associated with the svUnit 
package detailing all its features. Just make:

library(svUnit)
vignette("svUnit")

once the svUnit package is installed in R.

We will be happy to receive comments, bug reports and other suggestions 
during this beta test. Use the bug and suggestions tracker on:

https://r-forge.r-project.org/tracker/?group_id=194

Otherwise, I plan to submit an abstract about svUnit to User!2009 soon.

All the best,

Philippe Grosjean

..............................................<?}))><........
  ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..............................................................
Tobias Verbeke wrote: