Hi Seth,

first of all note that it was a deliberate decision to leave it up to the RUnit user to load all the functions and packages to be tested because loading and sourcing is always very site-specific. RUnit just assumes that all functionality to be tested is already present in the R session.

If you don't organize your code into packages but source individual R files your approach to source the code at the beginning of a test file looks the right thing to do.

We mainly use packages and the code we use to test packages A and B, say, looks like this:

library("A")
library("B")
testsuite.A <- defineTestSuite("A", "location_of_package_A/tests")
testsuite.B <- defineTestSuite("B", "location_of_package_B/tests")
testresult <- runTestSuite(list(testsuite.A, testsuite.B))
printHTMLProtocol(testresult, "location_of_testProtocol")

We use the tests subdirectory of a package to store our RUnit tests even though this is not really according to R conventions.

The nice thing is that this code can be executed in batch mode from a shell script. This script is executed nightly (and before starting R checks out and installs the packages from CVS). In this way, we know the test status of our code every morning.


Hope this helps, Klaus










-- Klaus Juenemann Software Engineer/ Biostatistician Epigenomics AG Kleine Praesidentenstr. 1 10178 Berlin, Germany phone:+49-30-24345-393 fax:+49-30-24345-555 http://www.epigenomics.com [EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to