coldbox.system.testing.compat.framework

Class TestCase

WEB-INF.cftags.component
        extended by coldbox.system.testing.BaseSpec
            extended by coldbox.system.testing.compat.framework.TestCase
Class Attributes:
None
Direct Known Subclasses:
BaseTestCase

This is the TestBox MXUnit compatible object. You can use this object as a direct replacement To MXUnit BaseTest Case. All assertions found in this object delegate to our core Assertion object.

Constructor Summary
init()
Method Summary
any addAssertDecorator(string decoratorName)
     Utility for dynamically adding assertion behaviors at runtime.
any afterTests()
any assert(string condition, [any message=''])
     Assert that the passed expression is true.
any assertArrayEquals(array expected, array actual, [any message=''])
     Compares two arrays, element by element, and fails if differences exist.
any assertEquals(any expected, any actual, [any message=''])
     Core assertion that compares the values the EXPECTED and ACTUAL parameters.
any assertEqualsCase(any expected, any actual, [any message=''])
     Core assertion that compares the values the EXPECTED and ACTUAL parameters with case-sensitivity.
any assertEqualsWithTolerance(any expected, any actual, numeric tolerance, [any datePart=''], [any message=''])
     Assert that the passed in actual number or date is expected to be close to it within +/- a passed delta and optional datepart.
any assertFalse(string condition, [any message=''])
     Assert something is false.
any assertIsArray(any a, [any message=''])
     Assert something is array.
any assertIsDefined(any o, [any message=''])
     Assert something is defined or not.
any assertIsEmpty(any o, [any message=''])
     Assert string is empty.
any assertIsEmptyArray(any a, [any message=''])
     Assert array is empty.
any assertIsEmptyQuery(any q, [any message=''])
     Assert query is empty.
any assertIsEmptyStruct(any struct, [any message=''])
     Assert struct is empty.
any assertIsExactTypeOf(any o, any type, [any message=''])
     Assert something is of a certrain object type without any inheritance lookup.
any assertIsQuery(any q, [any message=''])
     Assert something is query.
any assertIsStruct(any actual, [any message=''])
     Assert something is struct.
any assertIsTypeOf(any actual, any typeName, [any message=''])
     Assert something is of a certrain object type.
any assertIsXMLDoc(any xml, [any message='Passed in xml is not a valid XML Object'])
     Assert something is an XMLDoc.
any assertNotEquals(any expected, any actual, [any message=''])
     Core assertion that compares the values the EXPECTED and ACTUAL parameters to NOT be equal.
any assertNotSame(any expected, any actual, [any message=''])
     Assert that an expected and actual objec is NOT the same instance This only works on objects that are passed by reference, please remember that in Railo arrays pass by reference and in Adobe CF they pass by value.
any assertQueryEquals(query expected, query actual, [any message=''])
     Compares 2 queries, cell by cell, and fails if differences exist.
any assertSame(any expected, any actual, [any message=''])
     Assert that an expected and actual objec is the same instance This only works on objects that are passed by reference, please remember that in Railo arrays pass by reference and in Adobe CF they pass by value.
any assertStructEquals(struct expected, struct actual, [any message=''])
     Compares two structures, key by key, and fails if differences exist.
any assertTrue(string condition, [any message=''])
     Assert something is true.
any beforeTests()
any debug(any var)
     MXUnit style debug.
any expectException([any expectedExceptionType], [any expectedExceptionMessage='.*'])
     Expect an exception from the testing spec.
any fail([any message=''])
     Fail assertion.
any getMockFactory()
any injectMethod(any receiver, any giver, string functionName, [string functionNameInReceiver='[runtime expression]'])
     injects the method from giver into receiver.
any injectProperty(any receiver, string propertyName, any propertyValue, [string scope='variables'])
     Injects properties into the receiving object.
any mock([any mocked])
remote any runTestRemote([any testMethod=''], [boolean debug='false'], [any output='simple'])
     Run a test remotely like MXUnit.
any setMockingFramework()
any setup()
any teardown()
 
Methods inherited from class coldbox.system.testing.BaseSpec
addAssertions, addMatchers, afterEach, beforeEach, clearDebugBuffer, closureStub, console, createEmptyMock, createMock, createStub, describe, expect, expectedException, getDebugBuffer, getMockBox, hasExpectedException, isExpectedException, it, makePublic, prepareMock, print, println, querySim, runRemote, runSpec, runTestMethod, xdescribe, xit
 
Methods inherited from class WEB-INF.cftags.component
None

Constructor Detail

init

public init()


Method Detail

addAssertDecorator

public any addAssertDecorator(string decoratorName)

Utility for dynamically adding assertion behaviors at runtime

Parameters:
decoratorName - The fully qualied name of the assertion component to add; e.g., org.mycompany.MyAssertionComponent

afterTests

public any afterTests()


assert

public any assert(string condition, [any message=''])

Assert that the passed expression is true

Overrides:
assert in class BaseSpec
Parameters:
condition
message

assertArrayEquals

public any assertArrayEquals(array expected, array actual, [any message=''])

Compares two arrays, element by element, and fails if differences exist

Parameters:
expected
actual
message

assertEquals

public any assertEquals(any expected, any actual, [any message=''])

Core assertion that compares the values the EXPECTED and ACTUAL parameters

Parameters:
expected
actual
message

assertEqualsCase

public any assertEqualsCase(any expected, any actual, [any message=''])

Core assertion that compares the values the EXPECTED and ACTUAL parameters with case-sensitivity

Parameters:
expected
actual
message

assertEqualsWithTolerance

public any assertEqualsWithTolerance(any expected, any actual, numeric tolerance, [any datePart=''], [any message=''])

Assert that the passed in actual number or date is expected to be close to it within +/- a passed delta and optional datepart

Parameters:
expected
actual
tolerance
datePart
message

assertFalse

public any assertFalse(string condition, [any message=''])

Assert something is false

Parameters:
condition
message

assertIsArray

public any assertIsArray(any a, [any message=''])

Assert something is array

Parameters:
a
message

assertIsDefined

public any assertIsDefined(any o, [any message=''])

Assert something is defined or not

Parameters:
o
message

assertIsEmpty

public any assertIsEmpty(any o, [any message=''])

Assert string is empty

Parameters:
o
message

assertIsEmptyArray

public any assertIsEmptyArray(any a, [any message=''])

Assert array is empty

Parameters:
a
message

assertIsEmptyQuery

public any assertIsEmptyQuery(any q, [any message=''])

Assert query is empty

Parameters:
q
message

assertIsEmptyStruct

public any assertIsEmptyStruct(any struct, [any message=''])

Assert struct is empty

Parameters:
struct
message

assertIsExactTypeOf

public any assertIsExactTypeOf(any o, any type, [any message=''])

Assert something is of a certrain object type without any inheritance lookup

Parameters:
o
type
message

assertIsQuery

public any assertIsQuery(any q, [any message=''])

Assert something is query

Parameters:
q
message

assertIsStruct

public any assertIsStruct(any actual, [any message=''])

Assert something is struct

Parameters:
actual
message

assertIsTypeOf

public any assertIsTypeOf(any actual, any typeName, [any message=''])

Assert something is of a certrain object type

Parameters:
actual
typeName
message

assertIsXMLDoc

public any assertIsXMLDoc(any xml, [any message='Passed in xml is not a valid XML Object'])

Assert something is an XMLDoc

Parameters:
xml
message

assertNotEquals

public any assertNotEquals(any expected, any actual, [any message=''])

Core assertion that compares the values the EXPECTED and ACTUAL parameters to NOT be equal

Parameters:
expected
actual
message

assertNotSame

public any assertNotSame(any expected, any actual, [any message=''])

Assert that an expected and actual objec is NOT the same instance This only works on objects that are passed by reference, please remember that in Railo arrays pass by reference and in Adobe CF they pass by value.

Parameters:
expected
actual
message

assertQueryEquals

public any assertQueryEquals(query expected, query actual, [any message=''])

Compares 2 queries, cell by cell, and fails if differences exist

Parameters:
expected
actual
message

assertSame

public any assertSame(any expected, any actual, [any message=''])

Assert that an expected and actual objec is the same instance This only works on objects that are passed by reference, please remember that in Railo arrays pass by reference and in Adobe CF they pass by value.

Parameters:
expected
actual
message

assertStructEquals

public any assertStructEquals(struct expected, struct actual, [any message=''])

Compares two structures, key by key, and fails if differences exist

Parameters:
expected
actual
message

assertTrue

public any assertTrue(string condition, [any message=''])

Assert something is true

Parameters:
condition
message

beforeTests

public any beforeTests()


debug

public any debug(any var)

MXUnit style debug

Overrides:
debug in class BaseSpec
Parameters:
var - The variable to debug

expectException

public any expectException([any expectedExceptionType], [any expectedExceptionMessage='.*'])

Expect an exception from the testing spec

Parameters:
expectedExceptionType - the type to expect
expectedExceptionMessage - Optional exception message

fail

public any fail([any message=''])

Fail assertion

Overrides:
fail in class BaseSpec
Parameters:
message - The message to fail with

getMockFactory

public any getMockFactory()


injectMethod

public any injectMethod(any receiver, any giver, string functionName, [string functionNameInReceiver='[runtime expression]'])

injects the method from giver into receiver. This is helpful for quick and dirty mocking

Parameters:
receiver
giver
functionName
functionNameInReceiver

injectProperty

public any injectProperty(any receiver, string propertyName, any propertyValue, [string scope='variables'])

Injects properties into the receiving object

Parameters:
receiver
propertyName
propertyValue
scope

mock

public any mock([any mocked])

Parameters:
mocked

runTestRemote

remote any runTestRemote([any testMethod=''], [boolean debug='false'], [any output='simple'])

Run a test remotely like MXUnit

Parameters:
testMethod - A list or array of test names that are the ones that will be executed ONLY!
debug - Show debug output on the reports or not
output - The type of reporter to run the test with

setMockingFramework

public any setMockingFramework()


setup

public any setup()


teardown

public any teardown()