## run some test suite
myTestSuite <- defineTestSuite("RUnit Example", system.file("examples", package="RUnit"), testFileRegexp="correctTestCase.r")
testResult <- runTestSuite(myTestSuite)
## prints detailed text protocol
## to standard out:
printTextProtocol(testResult, showDetails=TRUE)
## prints detailed html protocol
## to standard out
printHTMLProtocol(testResult)
## example function to add links to URL of the code files in a code
## repository, here the SourceForge repository
testFileToSFLinkMap <- function(testFileName, testDir="tests") {
## get unit test file name
bname <- basename(testFileName)
## figure out package name
regExp <- paste("^.*/([\.a-zA-Z0-9]*)/",testDir,"/.*$", sep="")
pack <- sub(regExp, "\1", testFileName)
return(paste("http://runit.cvs.sourceforge.net/runit/",
pack, testDir, bname, sep="/"))
}
## example call for a test suite run on the RUnit package
testSuite <- defineTestSuite("RUnit", "<path-to-source-folder>/RUnit/tests", testFileRegexp="^test.+")
testResult <- runTestSuite(testSuite)
printHTMLProtocol(testResult, fileName = "RUnit-unit-test-log.html", testFileToLinkMap=testFileToSFLinkMap )Run the code above in your browser using DataLab