R: Objects of class 'svTestData' contain results from running a...

svTestData {svUnit} | R Documentation

## Objects of class 'svTestData' contain results from running a test

### Description

The 'svTestData' contains results of test run. The `checkxxx()` functions and the `runTest()` method generate one such object which is located in the `.Log` object in .GlobalEnv. It is then possible to display and report information it contains in various ways to analyze the results.

### Usage

    is.svTestData(x)

    stats(object, ...)
    ## S3 method for class 'svTestData'
    stats(object, ...)

    ## S3 method for class 'svTestData'
    print(x, all = FALSE, header = TRUE, file = "",
    	append = FALSE, ...)
    ## S3 method for class 'svTestData'
    summary(object, header = TRUE, file = "",
    	append = FALSE, ...)

### Arguments

`x` | any kind of object, or a 'svTestData' object in the case of `print`.
`object` | a 'svTestData' object.
`all` | do we print concise report for all test, or only for the tests that fail or produce an error?
`header` | do we print a header or not?
`file` | character. The path to the file where to write the report. If `file = ""`, the report is output to the console.
`append` | do we append to this file?
`...` | further arguments to pass to methods. Not used yet.

### Value

`is.svTestData()` returns `TRUE` if the object is an 'svTestData'. The various methods serve to extract or print content in the object.

### Author(s)

Philippe Grosjean <phgrosjean@sciviews.org>

### See Also

`svTest`, `svSuiteData`, `check`, `Log`

### Examples

    foo <- function(x, y = 2) return(x * y)
    is.test(foo)  # No
    ## Create test cases for this function
    test(foo) <- function () {
    	checkEqualsNumeric(4, foo(2))
    	checkEqualsNumeric(5, foo(2, 3))
    	checkEqualsNumeric(5, foo(nonexists))
    }
    ## Generate a 'svTestData' object by running the test
    obj <- runTest(foo)  # Equivalent to runTest(test(foo)), but shorter
    obj
    summary(obj)
    stats(obj)
    is.svTestData(obj)

    rm(foo, obj)

[Package svUnit version 0.7-12 Index]