## ## RUnit test run HTML log generation ## example script ## ## burgerm at users.sorceforge.net ## 31/08/2006 ## ## ------------------------------------ ## configure to your needs pkgName <- "RUnit" srcLibDir <- "~/workspace" cvsBaseUrl <- "http://runit.cvs.sourceforge.net/runit" ## ------------------------------------ library(pkgName, character.only=TRUE) pkgVersion <- packageDescription(pkgName, field="Version") rVersion <- paste(R.version$major, R.version$minor,sep=".") protHtmlFileName <- paste(paste("RUnit", pkgVersion,"R", rVersion, sep="-"), ".html", sep="") testFileToCvsLinkMap <- 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) ## URLs always use /, so we use paste return(paste(cvsBaseUrl, pack, testDir, bname, sep="/")) } ## define the test suite, here one package tS <- defineTestSuite(pkgName, file.path(srcLibDir, pkgName, "tests")) ## execute runner testData <- try(runTestSuite(tS)) ## export log printHTMLProtocol(testData, fileName = protHtmlFileName, testFileToLinkMap = testFileToCvsLinkMap) ## done