[rkward-cvs] SF.net SVN: rkward:[3114] trunk/rkward
m-eik at users.sourceforge.net
m-eik at users.sourceforge.net
Thu Oct 7 15:38:02 UTC 2010
Revision: 3114
http://rkward.svn.sourceforge.net/rkward/?rev=3114&view=rev
Author: m-eik
Date: 2010-10-07 15:38:02 +0000 (Thu, 07 Oct 2010)
Log Message:
-----------
rkwardtests: packaging finished, append and test.id features implemented
Modified Paths:
--------------
trunk/rkward/rkward/rbackend/rpackages/rkwardtests/DESCRIPTION
trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rktest.makeplugintests.R
trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rktest.runRKTestSuite.R
trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rkwardtests-internal.R
trunk/rkward/rkward/rbackend/rpackages/rkwardtests/man/rktest.makeplugintests.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwardtests/man/rktest.runRKTestSuite.Rd
trunk/rkward/tests/analysis_plugins.R
trunk/rkward/tests/distributions.R
trunk/rkward/tests/import_export_plugins.R
trunk/rkward/tests/item_response_theory.R
trunk/rkward/tests/plots.R
trunk/rkward/tests/rkward_application_tests.R
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwardtests/DESCRIPTION
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwardtests/DESCRIPTION 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwardtests/DESCRIPTION 2010-10-07 15:38:02 UTC (rev 3114)
@@ -3,8 +3,8 @@
Title: RKWard Plugin Test Suite Framework
Version: 0.5.5
Date: 2010-10-07
-Author: Thomas Friedrichsmeier
-Maintainer: Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de>, m.eik michalke <meik.michalke at uni-duesseldorf.de>
+Author: Thomas Friedrichsmeier, Meik Michalke
+Maintainer: Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de>, Meik Michalke <meik.michalke at uni-duesseldorf.de>
Depends: R (>= 2.9.0),methods
Description: A set of functions, classes and methods to test plugins that were written for RKWard.
License: GPL (>= 2)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rktest.makeplugintests.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rktest.makeplugintests.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rktest.makeplugintests.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -3,23 +3,26 @@
#' The function \code{rktest.makeplugintests} will run a whole test suite that was prepared to check one or several RKWard plugins.
#'
#' @title Run RKWard plugin test suite
-#' @usage rktest.makeplugintests(testsuites, testroot, outfile="make_plugintests.txt")
+#' @usage rktest.makeplugintests(testsuites, testroot, outfile="make_plugintests.txt", append=FALSE, test.id=NULL)
#' @aliases rktest.makeplugintests
-#' @param testsuites A character vector naming the test suites to be run.
-#' @param testroot A character vector pointing to the root directory where the test suite resides (including its folder with test standards).
+#' @param testsuites A character string or vector naming the test suites to be run.
+#' @param testroot A character string pointing to the root directory where the test suite resides (including its folder with test standards).
#' @param outfile A character string giving a file name for the result log.
+#' @param append If TRUE, append output to an existing file.
+#' @param test.id An optional character string or vector naming one or more tests of a suite to be run (if NULL, all tests are run).
#' @return Results are printed to stdout and saved to the defined output file.
#' @docType function
-#' @author Thomas Friedrichsmeier \email{thomas.friedrichsmeier@@ruhr-uni-bochum.de}
+#' @author Thomas Friedrichsmeier \email{thomas.friedrichsmeier@@ruhr-uni-bochum.de}, Meik Michalke \email{meik.michalke@@uni-duesseldorf.de}
#' @keywords utilities
#' @seealso \code{\link[rkwardtests:RKTestSuite]{RKTestSuite-class}}, \code{\link[rkwardtests:RKTestResult]{RKTestResult-class}}
#' @export
#' @examples
#' \dontrun{
#' rktest.makeplugintests(testsuites=c("rkward_application_tests.R", "import_export_plugins.R"), testroot=getwd())
+#' rktest.makeplugintests(testsuites="distribution.R", testroot=getwd(), test.id=c("poisson_quantiles", "geom_quantiles"))
#' }
-rktest.makeplugintests <- function(testsuites, testroot, outfile="make_plugintests.txt"){
+rktest.makeplugintests <- function(testsuites, testroot, outfile="make_plugintests.txt", append=FALSE, test.id=NULL){
## change to test root directory
oldwd <- getwd()
on.exit(setwd(oldwd))
@@ -28,11 +31,7 @@
## initialize
rktest.initializeEnvironment()
- ## add your test suite files, to this vector:
- #testsuites <- c ("rkward_application_tests.R", "import_export_plugins.R", "item_response_theory.R", "analysis_plugins.R", "distributions.R", "plots.R")
-
- #plugintest.outfile <- 'make_plugintests.txt'
- sink (file = outfile, append=FALSE, type="output", split=TRUE)
+ sink (file = outfile, append=append, type="output", split=TRUE)
cat ("RKWard Version:\n")
print (.rk.app.version)
cat ("\n\nR-Version:\n")
@@ -43,8 +42,8 @@
allresults <- new ("RKTestResult")
for (testsuite in testsuites) {
source (testsuite)
+ results <- rktest.runRKTestSuite (suite=suite, basedir=getwd(), test.id=test.id)
allresults <- rktest.appendTestResults (allresults, results)
- rm ("results")
}
cat ("\n\nOverall results:\n")
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rktest.runRKTestSuite.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rktest.runRKTestSuite.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rktest.runRKTestSuite.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -3,13 +3,14 @@
#' This function can be called to run a single plugin test suite.
#'
#' @title Run RKWard plugin test suite
-#' @usage rktest.runRKTestSuite(suite, basedir=getwd())
+#' @usage rktest.runRKTestSuite(suite, basedir=getwd(), test.id=NULL)
#' @aliases rktest.runRKTestSuite
#' @param suite Character string naming the test suite to run.
#' @param basedir Defaults to the working directory.
+#' @param test.id An optional character string or vector naming one or more tests of a suite to be run (if NULL, all tests are run).
#' @return An object of class \code{\link[rkwardtests:RKTestResult]{RKTestResult-class}}.
#' @docType function
-#' @author Thomas Friedrichsmeier \email{thomas.friedrichsmeier@@ruhr-uni-bochum.de}
+#' @author Thomas Friedrichsmeier \email{thomas.friedrichsmeier@@ruhr-uni-bochum.de}, Meik Michalke \email{meik.michalke@@uni-duesseldorf.de}
#' @keywords utilities
#' @seealso \code{\link[rkwardtests:RKTestSuite]{RKTestSuite-class}}, \code{\link[rkwardtests:rktest.makeplugintests]{rktest.makeplugintests}}
#' @export
@@ -18,7 +19,7 @@
#' result <- rktest.runRKTestSuite()
#' }
-rktest.runRKTestSuite <- function (suite, basedir=getwd ()) {
+rktest.runRKTestSuite <- function (suite, basedir=getwd (), test.id=NULL) {
rktest.initializeEnvironment ()
result <- new ("RKTestResult") # FALSE by default
@@ -37,6 +38,10 @@
}
rk.sync.global () # objects might have been added/changed in the init calls
+ # check if only a subset of tests is desired
+ if(length(test.id) > 0)
+ suite at tests <- suite at tests[is.element(sapply(suite at tests, function(test){test at id}), test.id)]
+
for (i in 1:length (suite at tests)) {
suite at tests[[i]]@libraries <- c(suite at libraries, suite at tests[[i]]@libraries)
try (res <- rktest.runRKTest(suite at tests[[i]]))
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rkwardtests-internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rkwardtests-internal.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rkwardtests-internal.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -186,6 +186,5 @@
# counterpart to rktest.initializeEnvironment. Restores the most important settings
rktest.resetEnvironment <- function () {
- rm (list=c ("rk.set.output.html.file", "rk.get.tempfile.name", ".rk.make.hr"), envir=globalenv ())
.rk.rerun.plugin.link <<- .rk.rerun.plugin.link.replacement
}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwardtests/man/rktest.makeplugintests.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwardtests/man/rktest.makeplugintests.Rd 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwardtests/man/rktest.makeplugintests.Rd 2010-10-07 15:38:02 UTC (rev 3114)
@@ -1,20 +1,23 @@
\name{rktest.makeplugintests}
\alias{rktest.makeplugintests}
\title{Run RKWard plugin test suite}
-\usage{rktest.makeplugintests(testsuites, testroot, outfile="make_plugintests.txt")}
+\usage{rktest.makeplugintests(testsuites, testroot, outfile="make_plugintests.txt", append=FALSE, test.id=NULL)}
\description{Run a whole RKWard plugin test suite}
\details{The function \code{rktest.makeplugintests} will run a whole test suite that was prepared to check one or several RKWard plugins.}
\alias{rktest.makeplugintests}
\value{Results are printed to stdout and saved to the defined output file.}
\docType{function}
-\author{Thomas Friedrichsmeier \email{thomas.friedrichsmeier at ruhr-uni-bochum.de}}
+\author{Thomas Friedrichsmeier \email{thomas.friedrichsmeier at ruhr-uni-bochum.de}, Meik Michalke \email{meik.michalke at uni-duesseldorf.de}}
\keyword{utilities}
\seealso{\code{\link[rkwardtests:RKTestSuite]{RKTestSuite-class}}, \code{\link[rkwardtests:RKTestResult]{RKTestResult-class}}}
-\arguments{\item{testsuites}{A character vector naming the test suites to be run.}
-\item{testroot}{A character vector pointing to the root directory where the test suite resides (including its folder with test standards).}
+\arguments{\item{testsuites}{A character string or vector naming the test suites to be run.}
+\item{testroot}{A character string pointing to the root directory where the test suite resides (including its folder with test standards).}
\item{outfile}{A character string giving a file name for the result log.}
+\item{append}{If TRUE, append output to an existing file.}
+\item{test.id}{An optional character string or vector naming one or more tests of a suite to be run (if NULL, all tests are run).}
}
\examples{\dontrun{
rktest.makeplugintests(testsuites=c("rkward_application_tests.R", "import_export_plugins.R"), testroot=getwd())
+rktest.makeplugintests(testsuites="distribution.R", testroot=getwd(), test.id=c("poisson_quantiles", "geom_quantiles"))
}}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwardtests/man/rktest.runRKTestSuite.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwardtests/man/rktest.runRKTestSuite.Rd 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwardtests/man/rktest.runRKTestSuite.Rd 2010-10-07 15:38:02 UTC (rev 3114)
@@ -1,17 +1,18 @@
\name{rktest.runRKTestSuite}
\alias{rktest.runRKTestSuite}
\title{Run RKWard plugin test suite}
-\usage{rktest.runRKTestSuite(suite, basedir=getwd())}
+\usage{rktest.runRKTestSuite(suite, basedir=getwd(), test.id=NULL)}
\description{Run a single RKWard plugin test suite}
\details{This function can be called to run a single plugin test suite.}
\alias{rktest.runRKTestSuite}
\value{An object of class \code{\link[rkwardtests:RKTestResult]{RKTestResult-class}}.}
\docType{function}
-\author{Thomas Friedrichsmeier \email{thomas.friedrichsmeier at ruhr-uni-bochum.de}}
+\author{Thomas Friedrichsmeier \email{thomas.friedrichsmeier at ruhr-uni-bochum.de}, Meik Michalke \email{meik.michalke at uni-duesseldorf.de}}
\keyword{utilities}
\seealso{\code{\link[rkwardtests:RKTestSuite]{RKTestSuite-class}}, \code{\link[rkwardtests:rktest.makeplugintests]{rktest.makeplugintests}}}
\arguments{\item{suite}{Character string naming the test suite to run.}
\item{basedir}{Defaults to the working directory.}
+\item{test.id}{An optional character string or vector naming one or more tests of a suite to be run (if NULL, all tests are run).}
}
\examples{\dontrun{
result <- rktest.runRKTestSuite()
Modified: trunk/rkward/tests/analysis_plugins.R
===================================================================
--- trunk/rkward/tests/analysis_plugins.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/tests/analysis_plugins.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -1,9 +1,3 @@
-## intro
-# This should be the first line in each test suite file: Include the
-# test framework, unless already included (multiple inclusion would not
-# really do any harm either, though
-if (!isClass ("RKTestSuite")) source ("test_framework.R")
-
## definition of the test suite
suite <- new ("RKTestSuite", id="analysis_plugins",
# place here libraries that are required for *all* tests in this suite, or highly likely to be installed
@@ -154,7 +148,3 @@
}
)
)
-
-## always store the result in "results" and print it
-results <- rktest.runRKTestSuite (suite)
-print (results)
Modified: trunk/rkward/tests/distributions.R
===================================================================
--- trunk/rkward/tests/distributions.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/tests/distributions.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -1,9 +1,3 @@
-## intro
-# This should be the first line in each test suite file: Include the
-# test framework, unless already included (multiple inclusion would not
-# really do any harm either, though
-if (!isClass ("RKTestSuite")) source ("test_framework.R")
-
## definition of the test suite
suite <- new ("RKTestSuite", id="distributions",
# place here libraries that are required for *all* tests in this suite, or highly likely to be installed
@@ -284,7 +278,3 @@
}
)
)
-
-## always store the result in "results" and print it
-results <- rktest.runRKTestSuite (suite)
-print (results)
Modified: trunk/rkward/tests/import_export_plugins.R
===================================================================
--- trunk/rkward/tests/import_export_plugins.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/tests/import_export_plugins.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -1,9 +1,3 @@
-## intro
-# This should be the first line in each test suite file: Include the
-# test framework, unless already included (multiple inclusion would not
-# really do any harm either, though
-if (!isClass ("RKTestSuite")) source ("test_framework.R")
-
## definition of the test suite
suite <- new ("RKTestSuite", id="import_export_plugins",
# place here libraries that are required for *all* tests in this suite, or highly likely to be installed
@@ -118,7 +112,3 @@
})
), postCalls = list () # like initCalls: run after all tests to clean up. Empty in this case.
)
-
-## always store the result in "results" and print it
-results <- rktest.runRKTestSuite (suite)
-print (results)
Modified: trunk/rkward/tests/item_response_theory.R
===================================================================
--- trunk/rkward/tests/item_response_theory.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/tests/item_response_theory.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -1,6 +1,3 @@
-## intro
-if (!isClass ("RKTestSuite")) source ("test_framework.R")
-
## definition of the test suite
suite <- new ("RKTestSuite", id="item_response_theory",
libraries = c ("ltm", "eRm"),
@@ -156,7 +153,3 @@
}
)
)
-
-## always store the result in "results" and print it
-results <- rktest.runRKTestSuite (suite)
-print (results)
Modified: trunk/rkward/tests/plots.R
===================================================================
--- trunk/rkward/tests/plots.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/tests/plots.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -1,9 +1,3 @@
-## intro
-# This should be the first line in each test suite file: Include the
-# test framework, unless already included (multiple inclusion would not
-# really do any harm either, though
-if (!isClass ("RKTestSuite")) source ("test_framework.R")
-
## definition of the test suite
suite <- new ("RKTestSuite", id="plots",
# place here libraries that are required for *all* tests in this suite, or highly likely to be installed
@@ -72,7 +66,3 @@
}
)
)
-
-## always store the result in "results" and print it
-results <- rktest.runRKTestSuite (suite)
-print (results)
Modified: trunk/rkward/tests/rkward_application_tests.R
===================================================================
--- trunk/rkward/tests/rkward_application_tests.R 2010-10-07 15:25:11 UTC (rev 3113)
+++ trunk/rkward/tests/rkward_application_tests.R 2010-10-07 15:38:02 UTC (rev 3114)
@@ -1,9 +1,3 @@
-## intro
-# This should be the first line in each test suite file: Include the
-# test framework, unless already included (multiple inclusion would not
-# really do any harm either, though
-if (!isClass ("RKTestSuite")) source ("test_framework.R")
-
## definition of the test suite
suite <- new ("RKTestSuite", id="rkward_application_tests",
# place here libraries that are required for *all* tests in this suite, or highly likely to be installed
@@ -256,7 +250,3 @@
}
)
)
-
-## always store the result in "results" and print it
-results <- rktest.runRKTestSuite (suite)
-print (results)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list