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, ...)

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

Arguments

x

Any kind of object, or a 'svTestData' object in the case of print().

object

A 'svTestData' object.

...

Further arguments to pass to methods. Not used yet.

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?

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

See Also

svTest(), is.svSuiteData(), Log(), checkEquals()

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 1.0.6 Index]