testtube.Test¶
Test
is the base test class that all tests should
instantiate and all test classes (e.g., HttpTest
) should
inherit from.
Class¶
-
class
testtube.
Test
()
Properties¶
- ¶
name string
Default the module’s filename (sans extension) Description A descriptive name for the test or test suite.
- ¶
description string
Default undefined
Description A short description of the test or test suite.
- ¶
parent Default undefined
Description A back reference to the test’s parent.
- ¶
errorExpected boolean
|Error
|function
Default false
Description Indicate that an error is expected to be thrown somewhere in the test and, if desired, verify the type of contents of that error (see: assert.throws
.
- ¶
selfBeforeChildren boolean
Default false
Description If both doTest
andtests
are defined, executedoTest
before iterating throughtests
.
- ¶
tests Array
Default []
Description Child tests to be executed as part of the test suite.
Methods¶
- ¶
setup Arguments - context (
TestContext
) – the test context - done (
function
) – callback used to end asynchronous tests
Description Called before doTest
and/or before iterating throughtests
. Both arguments are optional, but will determine how the test runner calls this method. If there is one argument in the signature, the context will be passed. If there are two, the second parameter must be called for execution to continue.Description NOTE: It is OK to throw assertions in this method. - context (
- ¶
teardown Arguments - context (
TestContext
) – the test context - done (
function
) – callback used to end asynchronous tests
Description Called after doTest
and/or after iterating throughtests
. The arguments and the semantics they imply are the same as forsetup
.Description NOTE: It is OK to throw assertions in this method. - context (
- ¶
doTest Arguments - context (
TestContext
) – the test context - done (
function
) – callback used to end asynchronous tests
Description Called to execute the test. If no error is thrown, the test will be marked a success. The arguments and the semantics they imply are the same as for setup
.- context (
- ¶
run Arguments - context (
TestContext
) – the test context - done (
function
) – callback used to end asynchronous tests
Description This can be called directly to begin execution of a test suite programmatically. It will log tests and their results during execution and return a results object for inspection, but will not generate the formatted report. The arguments and the semantics they imply are the same as for setup
.- context (