<Test>

JavaScript: lz.Test
extends <DebugObject> » <view> » <node> » lz.Eventable »
Test is the abstract interface class for all LZUnit tests. It accumulates the results of the test and defines the various assert methods that can be used to implement each test. <TestCase> and <TestResult> extend this class to provide functionality.

Attributes inherited from <DebugObject>

debugWrite

Methods

assertEquals()
Test.assertEquals(expected, actual, message);
Assert that an actual value equals (==) an expected value.
Parameter Name Type Description
expected   the expected value
actual   the actual value
message   (optional) the failure message

assertFalse()
Test.assertFalse(condition, assertion);
Assert that a condition is false. Note that this tests that condition, if supplied as the argument to an if statement, would cause the else clause to be chosen. This does not test that condition == false, or that condition === false, use assertEquals or assertSame to make such tests.
Parameter Name Type Description
condition   the condition to be tested
assertion   (optional) the assertion the condition represents

assertNotNull()
Test.assertNotNull(object, message);
Assert that a value is not (!==) null.
Parameter Name Type Description
object   the value to be tested
message   (optional) the failure message

assertNotSame()
Test.assertNotSame(expected, actual, message);
Assert that an actual value is not the same as (!==) an expected value.
Parameter Name Type Description
expected   the expected value
actual   the actual value
message   (optional) the failure message

assertNotUndefined()
Test.assertNotUndefined(object, message);
Assert that a value is not undefined.
Parameter Name Type Description
object   the value to be tested
message   (optional) the failure message

assertNull()
Test.assertNull(object, message);
Assert that a value is (===) null.
Parameter Name Type Description
object   the value to be tested
message   (optional) the failure message

assertSame()
Test.assertSame(expected, actual, message);
Assert that an actual value is the same as (===) an expected value.
Parameter Name Type Description
expected   the expected value
actual   the actual value
message   (optional) the failure message

assertTrue()
Test.assertTrue(condition, assertion);
Assert that a condition is true. Note that this tests that condition, if supplied as the argument to an if statement, would cause the then clause to be chosen. This does not test that condition == true, or that condition === true, use assertEquals or assertSame to make such tests.
Parameter Name Type Description
condition   the condition to be tested
assertion   (optional) the assertion the condition represents

assertUndefined()
Test.assertUndefined(object, message);
Assert that a value is undefined.
Parameter Name Type Description
object   the value to be tested
message   (optional) the failure message

assertWithin()
Test.assertWithin(expected, actual, delta, message);
Assert that an actual value is within delta of an expected value.
Parameter Name Type Description
expected   the expected value
actual   the actual value
delta   the tolerance
message   (optional) the failure message

displayMessage()
Test.displayMessage(...args);
Output a message on the result display Outputs a message without affecting the success/failure state of the test
Parameter Name Type Description
args ... Any number of parameters will be formatted using LzFormatter.formatToString and output to the display

error()
Test.error(message);
Record an error.
Parameter Name Type Description
message   the reason for the error

fail()
Test.fail(message);
Record a failure.
Parameter Name Type Description
message   the reason for the failure

Methods inherited from <formatter>

abbreviate, formatToString, pad

Methods inherited from <DebugObject>

jsTrue, xmlequals, xmlstringequals

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy