MXUnit 2.1.3 (Generated: 09/27/2012)

mxunit.framework
Class TestCase

WEB-INF.cftags.component
        extended by mxunit.framework.Assert
            extended by mxunit.framework.TestCase

public class TestCase
extends Assert

Composite parent of all TestCases. Extend this class to build and run tests within the MXUnit framework.


Method Summary
remote any TestCase([TestCase aTestCase='[runtime expression]'])
 any _getMockFactory()
          Returns the current MockFactory object
 any _setMockFactory(any mf)
          Dependency injection window
package boolean accept(struct testStruct)
          contains the logic for whether a test is a valid runnable method
 void addTrace([string message=''])
          Deprecated
 void afterTests()
 any applyDecorators(any object)
          applies the chain of decorators, if it exists
 void beforeTests()
 void clearDebug()
          Clears the debug array
 any createRequestScopeDebug()
private TestResult createResult()
 void debug(any var)
          Use in your tests to add simple or complex debug data to test results
 any disableAfterTests()
 any disableBeforeTests()
 any dump(any obj, [any label='MXUNIT Dump'])
 any enableAfterTests()
 any enableBeforeTests()
 any expectException([any expectedExceptionType], [any expectedExceptionMessage=''])
 Any getAnnotation([Any methodName=''], Any annotationName, [Any defaultValue=''])
          Returns the value for an annotation, allowing for an mxunit namespace or not
 any getBaseTarget()
          In case of decorators - return myself
 array getDebug()
          Returns the debug array
 struct getDebugWrapper()
          Returns the debug array
 any getExpectedExceptionMessage()
 any getExpectedExceptionType()
 any getMockFactory([Any fw=''])
          Returns the actual Mock factory of the framework
 any getRequiredDecoratorPaths()
          Returns a list of fully-qualified paths to framework-required decorators
 array getRunnableMethods()
          Gets an array of all runnable test methods for this test case
 any getVariablesScope()
          Front door into the Test's variables scope
 any initDebug()
private any initProperties()
 void injectMethod(any receiver, any giver, string functionName, [string functionNameInReceiver='[runtime expression]'])
          injects the method from giver into receiver
 void injectProperty(any receiver, string propertyName, any propertyValue, [string scope=''])
          injects properties into the receiving object
 string invokeTestMethod(string methodName, [struct args='[runtime expression]'])
          invoke the test method on this case, returns any output
package any makePublic(any ObjectUnderTest, string privateMethodName, [string proxyMethodName=''])
          makes a testable version of a private method for a given object
 any mock([any mocked=''], [string mockType], [string fw='MightyMock'])
          Returns a mock object via the configured Mock Factory
 boolean okToRunAfterTests()
 boolean okToRunBeforeTests()
 any orderedExpectation(any mocks)
          Method for mocking
 any print([any message])
          Wrapper for writeoutout()
 any println([any message])
          Wrapper for writeoutout()
 void restoreMethod(any receiver, string functionName)
          restores a previously overwritten method (via injectMethod) to its original state
remote any run([any testResult='[runtime expression]'])
          Main run method used by the Eclipse Plugin
 void runBare()
          Not really used
remote TestResult runTest([any suite='[runtime expression]'])
remote void runTestRemote([string testMethod=''], [boolean debug='false'], [string output='jqGrid'])
          Remote method for running tests quickly via Http
 void setDebugWrapper(struct debugArrayWrapper)
 any setExpectedExceptionMessage(string expectedExceptionMessage)
 any setExpectedExceptionType(string expectedExceptionType)
 any setMockingFramework(Any name)
          Allows a developer to set the default Mocking Framework for this test case
 void setUp()
 any stopRequestScopeDebug()
 void tearDown()
 string toStringValue()
          Returns the name of this TestCase
 
Methods inherited from class mxunit.framework.Assert
mxunit.framework.TestCase
 
Methods inherited from class WEB-INF.cftags.component
 

Method Detail

TestCase

remote any TestCase([TestCase aTestCase='[runtime expression]'])

Parameters:
aTestCase

_getMockFactory

public any _getMockFactory()
Returns the current MockFactory object.


_setMockFactory

public any _setMockFactory(any mf)
Dependency injection window.

Parameters:
mf

accept

package boolean accept(struct testStruct)
contains the logic for whether a test is a valid runnable method

Parameters:
testStruct - Structure for a function coming from getmetadata

addTrace

public void addTrace([string message=''])
Deprecated. Use debug() instead.

Parameters:
message

afterTests

public void afterTests()


applyDecorators

public any applyDecorators(any object)
applies the chain of decorators, if it exists

Parameters:
object - the object to check to see if it needs some decorators applied

beforeTests

public void beforeTests()


clearDebug

public void clearDebug()
Clears the debug array


createRequestScopeDebug

public any createRequestScopeDebug()


createResult

private TestResult createResult()


debug

public void debug(any var)
Use in your tests to add simple or complex debug data to test results. Used by Eclpise plugin heavily. Beware: adding lots of data, particularly object instances, will probably cause this to hang!

Parameters:
var

disableAfterTests

public any disableAfterTests()


disableBeforeTests

public any disableBeforeTests()


dump

public any dump(any obj, [any label='MXUNIT Dump'])

Parameters:
obj
label

enableAfterTests

public any enableAfterTests()


enableBeforeTests

public any enableBeforeTests()


expectException

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

Parameters:
expectedExceptionType
expectedExceptionMessage

getAnnotation

public Any getAnnotation([Any methodName=''], Any annotationName, [Any defaultValue=''])
Returns the value for an annotation, allowing for an mxunit namespace or not

Parameters:
methodName - The name of the test method. An empty string means a testCase annotation
annotationName - The name of the annotation
defaultValue - The value to return if no annotation is found

getBaseTarget

public any getBaseTarget()
In case of decorators - return myself


getDebug

public array getDebug()
Returns the debug array


getDebugWrapper

public struct getDebugWrapper()
Returns the debug array


getExpectedExceptionMessage

public any getExpectedExceptionMessage()


getExpectedExceptionType

public any getExpectedExceptionType()


getMockFactory

public any getMockFactory([Any fw=''])
Returns the actual Mock factory of the framework

Parameters:
fw - The name of the mocking framework to use

getRequiredDecoratorPaths

public any getRequiredDecoratorPaths()
Returns a list of fully-qualified paths to framework-required decorators


getRunnableMethods

public array getRunnableMethods()
Gets an array of all runnable test methods for this test case. This includes anything in its inheritance hierarchy


getVariablesScope

public any getVariablesScope()
Front door into the Test's variables scope


initDebug

public any initDebug()


initProperties

private any initProperties()


injectMethod

public void 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 - the object receiving the method
giver - the object giving the method
functionName - the function to be injected from the giver into the receiver
functionNameInReceiver - the function name that you will call. this is useful when you want to inject giver.someFunctionXXX but have it be called as someFunction in your receiver object

injectProperty

public void injectProperty(any receiver, string propertyName, any propertyValue, [string scope=''])
injects properties into the receiving object

Parameters:
receiver - the object receiving the method
propertyName - the property to be overwritten
propertyValue - the property value to be used
scope - the scope in which to set the property. Defaults to variables and this.

invokeTestMethod

public string invokeTestMethod(string methodName, [struct args='[runtime expression]'])
invoke the test method on this case, returns any output. Generally useful for decorators to intercept

Parameters:
methodName - the name of the method to invoke
args - Optional set of arguments

makePublic

package any makePublic(any ObjectUnderTest, string privateMethodName, [string proxyMethodName=''])
makes a testable version of a private method for a given object. This is a convenience pass-through to PublicProxyMaker.makePublic. See documentation on 'testing private methods' at mxunit.org/doc. Or open mxunit/tests/framework/PublicProxyMakerTest.cfc for examples of how to use

Parameters:
ObjectUnderTest - an instance of the object with a private method to be proxied
privateMethodName - name of the private method to be proxied
proxyMethodName - name of the proxy method name to be used; if not passed, defaults to the name of the private method prefixed with an underscore

mock

public any mock([any mocked=''], [string mockType], [string fw='MightyMock'])
Returns a mock object via the configured Mock Factory

Parameters:
mocked - Component name or an actual component
mockType - Type of mock to create (fast,typeSafe,...)
fw - The name of the mocking framework to use

okToRunAfterTests

public boolean okToRunAfterTests()


okToRunBeforeTests

public boolean okToRunBeforeTests()


orderedExpectation

public any orderedExpectation(any mocks)
Method for mocking. Creates an OrderedExpectation object used for verify the order in which mocks have been called

Parameters:
mocks - One or more mocks in which to verify order

print

public any print([any message])
Wrapper for writeoutout().

Parameters:
message

println

public any println([any message])
Wrapper for writeoutout().

Parameters:
message

restoreMethod

public void restoreMethod(any receiver, string functionName)
restores a previously overwritten method (via injectMethod) to its original state

Parameters:
receiver
functionName

run

remote any run([any testResult='[runtime expression]'])
Main run method used by the Eclipse Plugin

Parameters:
testResult

runBare

public void runBare()
Not really used


runTest

remote TestResult runTest([any suite='[runtime expression]'])

Parameters:
suite

runTestRemote

remote void runTestRemote([string testMethod=''], [boolean debug='false'], [string output='jqGrid'])
Remote method for running tests quickly via Http.

Parameters:
testMethod - A single test to run. If not specified, all tests are run.
debug - Flag to indicate whether or not to dump the test results to the screen.
output - Output format: html,xml,junitxml,jqGrid

setDebugWrapper

public void setDebugWrapper(struct debugArrayWrapper)

Parameters:
debugArrayWrapper

setExpectedExceptionMessage

public any setExpectedExceptionMessage(string expectedExceptionMessage)

Parameters:
expectedExceptionMessage

setExpectedExceptionType

public any setExpectedExceptionType(string expectedExceptionType)

Parameters:
expectedExceptionType

setMockingFramework

public any setMockingFramework(Any name)
Allows a developer to set the default Mocking Framework for this test case.

Parameters:
name - The name of the mocking framework to use

setUp

public void setUp()


stopRequestScopeDebug

public any stopRequestScopeDebug()


tearDown

public void tearDown()


toStringValue

public string toStringValue()
Returns the name of this TestCase


MXUnit 2.1.3 (Generated: 09/27/2012)