WEB-INF.cftags.component coldbox.system.testing.BaseSpec coldbox.system.testing.compat.framework.TestCase coldbox.system.testing.BaseTestCase
A base test case for doing ColdBox Testing based on the MXUnit Framework
Method Summary | |
---|---|
private void
|
$abort()
Facade for cfabort. |
private void
|
$dump(any var, [boolean isAbort='false'])
Facade for cfmx dump. |
private void
|
$include([string template])
Facade for cfinclude. |
private void
|
$rethrow(any throwObject)
Rethrow facade. |
private any
|
$throw(string message, [string detail=''], [string type='Framework'])
Facade for cfthrow. |
any
|
afterAll()
BDD: The main teardown for ColdBox enabled applications after all tests execute. |
any
|
afterTests()
xUnit: The main teardown for ColdBox enabled applications after all tests execute. |
private any
|
announceInterception(any state, [any interceptData='[runtime expression]'], [boolean async='false'], [boolean asyncAll='false'], [boolean asyncAllNoJoin='false'], [string asyncPriority='NORMAL'], [numeric asyncJoinTimeout='0'])
Announce an interception to the system. |
any
|
beforeAll()
BDD: The main setup method for running ColdBox Integration enabled tests. |
any
|
beforeTests()
The main setup method for running ColdBox Integration enabled tests. |
private any
|
execute(string event, [boolean private='false'], [boolean prepostExempt='false'], [struct eventArguments='[runtime expression]'], [boolean renderResults='false'])
Executes a framework lifecycle by executing an event. |
private string
|
getAppMapping()
Get the AppMapping used for this test case. |
private any
|
getCacheBox()
Get a reference to cachebox. |
private string
|
getColdboxAppKey()
Get the coldboxAppKey used to store the coldbox controller in application scope. |
private any<IColdboxApplicationCache>
|
getColdboxOCM([string cacheName='default'])
Get ColdboxOCM: coldbox. |
private string
|
getConfigMapping()
Get the ConfigMapping for this test case. |
private any
|
getController()
Get a reference to the ColdBox mock controller. |
private AbstractFlashScope
|
getFlashScope()
Returns to you the currently used flash ram object. |
private any
|
getInterceptor([string interceptorName], [boolean deepSearch='false'])
Get an interceptor. |
private any
|
getLogBox()
Get a logbox reference. |
private ConfigBean
|
getMockConfigBean([struct configStruct='[runtime expression]'])
I will return to you a configBean according to the mocking configuration structure you send in. |
private MockController
|
getMockController()
I will return a mock controller object. |
private DatasourceBean
|
getMockDatasource(string name, [string alias=''], [string dbtype=''], [string username=''], [string password=''])
I will return to you a datasourceBean according to the mocking parameters sent. |
private any
|
getMockModel(string name, [boolean clearMethods='false'])
*ColdBox must be loaded for this to work. |
private any
|
getMockPlugin(string path)
Get a plugin mocked with capabilities. |
private RequestBuffer
|
getMockRequestBuffer()
I will return to you a mock request buffer object used mostly in interceptor calls. |
private RequestContext
|
getMockRequestContext([boolean clearMethods='false'], [any decorator])
Builds an empty functioning request context mocked with methods via MockBox. |
private any
|
getModel([any name], [any dsl], [any<struct> initArguments='[runtime expression]'])
Create or retrieve model objects by convention. |
private any
|
getRequestContext()
Get a reference to the current mock request context. |
private Util
|
getUtil()
Create and return a util object. |
private any
|
getWireBox()
Get the wirebox instance. |
private void
|
metadataInspection()
Inspect test case for annotations. |
private void
|
reset()
Reset the persistence of the unit test coldbox app, basically removes the controller from application scope. |
private void
|
setAppMapping(string AppMapping)
Set the AppMapping for this test case. |
private void
|
setColdboxAppKey(string coldboxAppKey)
Override the coldboxAppKey, used to store the coldbox controller in application scope. |
private void
|
setConfigMapping(string ConfigMapping)
Set the ConfigMapping for this test case. |
any
|
setup()
This executes before any test method for integration tests. |
private void
|
setupRequest(string event)
Setup an initial request capture. |
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 |
Method Detail |
---|
Facade for cfabort
Facade for cfmx dump
var
isAbort
- Abort alsoFacade for cfinclude
template
Rethrow facade
throwObject
- The cfcatch objectFacade for cfthrow
message
detail
type
BDD: The main teardown for ColdBox enabled applications after all tests execute
xUnit: The main teardown for ColdBox enabled applications after all tests execute
afterTests
in class
TestCase
Announce an interception to the system. If you use the asynchronous facilities, you will get a thread structure report as a result.
state
- The interception state to executeinterceptData
- A data structure used to pass intercepted information.async
- If true, the entire interception chain will be ran in a separate thread.asyncAll
- If true, each interceptor in the interception chain will be ran in a separate thread and then joined together at the end.asyncAllNoJoin
- If true, each interceptor in the interception chain will be ran in a separate thread but NOT joined together at the end.asyncPriority
- The thread priority to be used. Either LOW, NORMAL or HIGH. The default value is NORMALasyncJoinTimeout
- The timeout in milliseconds for the join thread to wait for interceptor threads to finish. By default there is no timeout.BDD: The main setup method for running ColdBox Integration enabled tests
The main setup method for running ColdBox Integration enabled tests
beforeTests
in class
TestCase
Executes a framework lifecycle by executing an event. This method returns a request context object that can be used for assertions
event
- The event to executeprivate
- Call a private event or notprepostExempt
- If true, pre/post handlers will not be fired.eventArguments
- A collection of arguments to passthrough to the calling event handler methodrenderResults
- If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_contentGet the AppMapping used for this test case
Get a reference to cachebox
Get the coldboxAppKey used to store the coldbox controller in application scope.
Get ColdboxOCM: coldbox.system.cache.CacheManager or new CacheBox providers coldbox.system.cache.IColdboxApplicationCache
cacheName
- The cache name to retrieveGet the ConfigMapping for this test case
Get a reference to the ColdBox mock controller
Returns to you the currently used flash ram object
Get an interceptor
interceptorName
- The name of the interceptor to search fordeepSearch
- By default we search the cache for the interceptor reference. If true, we search all the registered interceptor states for a match.Get a logbox reference
I will return to you a configBean according to the mocking configuration structure you send in
configStruct
- A memento of name-value pairs to initI will return a mock controller object
I will return to you a datasourceBean according to the mocking parameters sent
name
- The name of the DSN on the ColdFusion administratoralias
- The alias to use, if not passed the name will be used also as the aliasdbtype
- The db type metadatausername
- The dsn username metadatapassword
- The password metadata*ColdBox must be loaded for this to work. Get a mock model object by convention. You can optional clear all the methods on the model object if you wanted to. The object is created but not initiated, that would be your job.
name
- The name of the model to mockclearMethods
- If true, all methods in the target mock object will be removed. You can then mock only the methods that you want to mockGet a plugin mocked with capabilities
path
- The path of the plugin to mockI will return to you a mock request buffer object used mostly in interceptor calls
Builds an empty functioning request context mocked with methods via MockBox. You can also optionally wipe all methods on it.
clearMethods
- Clear Methods on it?decorator
- The class path to the decorator to build into the mock request contextCreate or retrieve model objects by convention
name
- The mapping name or CFC instance path to try to build updsl
- The dsl string to use to retrieve the instance model object, mutually exclusive with 'name'initArguments
- The constructor structure of arguments to passthrough when initializing the instanceGet a reference to the current mock request context
Create and return a util object
Get the wirebox instance
Inspect test case for annotations
Reset the persistence of the unit test coldbox app, basically removes the controller from application scope
Set the AppMapping for this test case
AppMapping
Override the coldboxAppKey, used to store the coldbox controller in application scope.
coldboxAppKey
Set the ConfigMapping for this test case
ConfigMapping
This executes before any test method for integration tests.
setup
in class
TestCase
Setup an initial request capture. I basically look at the FORM/URL scopes and create the request collection out of them.
event
- The event to setup the request context with