lucee.Component testbox.system.BaseSpec testbox.system.compat.framework.TestCase coldbox.system.testing.BaseTestCase
Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- Base testing component to intergrate TestBox with ColdBox
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
appMapping
The application mapping this test links to.
|
true
|
false
|
|
any
|
coldboxAppKey
The application key for the ColdBox applicatin this test links to.
|
true
|
false
|
|
any
|
configMapping
The configuration location this test links to.
|
true
|
false
|
|
any
|
controller
The ColdBox controller this test links to.
|
true
|
false
|
Method Summary | |
---|---|
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. |
any
|
announce(any state, [struct data='[runtime expression]'], [boolean async='false'], [boolean asyncAll='false'], [boolean asyncAllJoin='true'], [any asyncPriority='NORMAL'], [numeric asyncJoinTimeout='0'])
Announce an interception. |
any
|
announceInterception(any state, [struct interceptData='[runtime expression]'], [boolean async='false'], [boolean asyncAll='false'], [boolean asyncAllJoin='true'], [any asyncPriority='NORMAL'], [numeric asyncJoinTimeout='0'])
|
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. |
any
|
delete([string route=''], [struct params='[runtime expression]'], [struct headers='[runtime expression]'], [boolean renderResults='true'], [boolean withExceptionHandling='false'])
Shortcut method to making a DELETE request through the framework. |
any
|
execute([string event=''], [string route=''], [string queryString=''], [boolean private='false'], [boolean prePostExempt='false'], [struct eventArguments='[runtime expression]'], [boolean renderResults='false'], [boolean withExceptionHandling='false'])
Executes a framework lifecycle by executing an event. |
private struct
|
explodeRoute(string route)
Separate a route into two parts: the base route, and a query string collection. |
any
|
get([string route=''], [struct params='[runtime expression]'], [struct headers='[runtime expression]'], [boolean renderResults='true'], [boolean withExceptionHandling='false'])
Shortcut method to making a GET request through the framework. |
string
|
getAppMapping()
|
any
|
getCache(any cacheName='default')
Get the CacheBox reference from the running application. |
any
|
getCacheBox()
Get the CacheBox reference from the running application. |
string
|
getColdboxAppKey()
|
string
|
getConfigMapping()
|
string
|
getController()
|
any
|
getFlashScope()
Get the RequestContext reference from the running application. |
any
|
getHandlerResults()
Get the results from a handler execution if any. |
any
|
getInstance([any name], [struct initArguments='[runtime expression]'], [any dsl])
Get a instance object from WireBox. |
any
|
getInterceptor(any interceptorName)
Get an interceptor reference. |
any
|
getLogBox()
Get the LogBox reference from the running application. |
any
|
getMockController()
I will return a mock controller object. |
any
|
getMockModel(any name, [boolean clearMethods='false'])
ColdBox must be loaded for this to work. |
any
|
getMockRequestContext([boolean clearMethods='false'], [any decorator])
Builds an empty functioning request context mocked with methods via MockBox. |
any
|
getModel()
|
any
|
getNativeStatusCode()
Get the status code set in the CFML engine. |
private any
|
getPageContextResponse()
Helper method to deal with ACF2016's overload of the page context response, come on Adobe, get your act together!. |
any
|
getRenderData()
Get the render data struct for a ColdBox integration test. |
any
|
getRenderedContent()
Get the rendered content from a ColdBox integration test. |
any
|
getRequestContext()
Get the RequestContext reference from the running application. |
any
|
getStatusCode()
Get the status code for a ColdBox integration test. |
any
|
getUtil()
Get the ColdBox global utility class. |
any
|
getWireBox()
Get the WireBox reference from the running application. |
any
|
metadataInspection()
Inspect test case for annotations. |
private struct
|
parseQueryString(string queryString)
Parses a query string into a struct. |
any
|
patch([string route=''], [struct params='[runtime expression]'], [struct headers='[runtime expression]'], [boolean renderResults='true'], [boolean withExceptionHandling='false'])
Shortcut method to making a PATCH request through the framework. |
any
|
post([string route=''], [struct params='[runtime expression]'], [struct headers='[runtime expression]'], [boolean renderResults='true'], [boolean withExceptionHandling='false'])
Shortcut method to making a POST request through the framework. |
private string
|
processException(any controller, any exception)
Process an exception and returns a rendered bug report. |
any
|
put([string route=''], [struct params='[runtime expression]'], [struct headers='[runtime expression]'], [boolean renderResults='true'], [boolean withExceptionHandling='false'])
Shortcut method to making a PUT request through the framework. |
any
|
request([string route=''], [struct params='[runtime expression]'], [struct headers='[runtime expression]'], [string method='GET'], [boolean renderResults='true'], [boolean withExceptionHandling='false'])
Shortcut method to making a request through the framework. |
any
|
reset([boolean clearMethods='false'], [any decorator])
Reset the persistence of the unit test coldbox app, basically removes the controller from application scope. |
any
|
setAppMapping(any appMapping)
|
any
|
setColdboxAppKey(any coldboxAppKey)
|
any
|
setConfigMapping(any configMapping)
|
any
|
setController(any controller)
|
any
|
setup()
This executes before any test method for integration tests. |
any
|
setupRequest(any event)
Setup an initial request capture. |
Methods inherited from class testbox.system.compat.framework.TestCase |
---|
addAssertDecorator, assert, assertArrayEquals, assertEquals, assertEqualsCase, assertEqualsWithTolerance, assertFalse, assertIsArray, assertIsDefined, assertIsEmpty, assertIsEmptyArray, assertIsEmptyQuery, assertIsEmptyStruct, assertIsExactTypeOf, assertIsQuery, assertIsStruct, assertIsTypeOf, assertIsXMLDoc, assertNotEquals, assertNotSame, assertQueryEquals, assertSame, assertStructEquals, assertTrue, debug, expectException, fail, getMockFactory, init, injectMethod, injectProperty, mock, runTestRemote, setMockingFramework, teardown |
Methods inherited from class testbox.system.BaseSpec |
---|
addAssertions, addMatchers, afterEach, aroundEach, aroundStub, beforeEach, clearDebugBuffer, closureStub, console, createEmptyMock, createMock, createStub, describe, expect, expectAll, expectedException, fdescribe, feature, ffeature, fgiven, fit, fscenario, fstory, fthen, fwhen, generateAroundEachClosuresStack, getDebugBuffer, getMockBox, getProperty, given, hasExpectedException, isExpectedException, it, makePublic, mockData, prepareMock, print, println, querySim, runAfterEachClosures, runAroundEachClosures, runBeforeEachClosures, runRemote, runSpec, runTestMethod, scenario, story, then, when, xdescribe, xfeature, xgiven, xit, xscenario, xstory, xthen, xwhen |
Methods inherited from class lucee.Component |
---|
None |
Property Detail |
---|
The application mapping this test links to
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe application key for the ColdBox applicatin this test links to
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe configuration location this test links to
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe ColdBox controller this test links to
access
- publicrequired
- falsereturntype
- anyserializable
- trueMethod Detail |
---|
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
testbox.system.compat.framework.TestCase
Announce an interception
state
- The interception state to announcedata
- 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.asyncAllJoin
- If true, each interceptor in the interception chain will be ran in a separate thread and joined together at the end by default. If you set this flag to false then there will be no joining and waiting for the threads to finalize.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.state
interceptData
async
asyncAll
asyncAllJoin
asyncPriority
asyncJoinTimeout
BDD: The main setup method for running ColdBox Integration enabled tests
The main setup method for running ColdBox Integration enabled tests
beforeTests
in class
testbox.system.compat.framework.TestCase
Shortcut method to making a DELETE request through the framework.
route
- The route to execute.params
- Params to pass to the `rc` scope.headers
- Custom headers to pass as from the requestrenderResults
- If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_contentwithExceptionHandling
- If true, then ColdBox will process any errors through the exception handling framework instead of just throwing the error. Default: false.Executes a framework lifecycle by executing an event. This method returns a request context object that is decorated and can be used for assertions. (e.g. '/login' which may route to 'sessions.new') calling event handler method. rendering procedures and store the rendered content in the RC as cbox_rendered_content. through the exception handling framework instead of just throwing the error. Default: false.
event
- The event to execute (e.g. 'main.index')route
- The route to executequeryString
private
- Call a private event or not.prePostExempt
- If true, pre/post handlers will not be fired.eventArguments
- A collection of arguments to passthrough to therenderResults
- If true, then it will try to do the normalwithExceptionHandling
- If true, then ColdBox will process any errorsSeparate a route into two parts: the base route, and a query string collection
route
- a string containing the route with an optional query string (e.g. '/posts?recent=true')Shortcut method to making a GET request through the framework.
route
- The route to execute.params
- Params to pass to the `rc` scope.headers
- Custom headers to pass as from the requestrenderResults
- If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_contentwithExceptionHandling
- If true, then ColdBox will process any errors through the exception handling framework instead of just throwing the error. Default: false.Get the CacheBox reference from the running application
cacheName
- The cache name to retrieve or returns the 'default' cache by default.Get the CacheBox reference from the running application
Get the RequestContext reference from the running application
Get the results from a handler execution if any
Get a instance object from WireBox
name
- The mapping name or CFC path to retrieveinitArguments
- The constructor structure of arguments to passthrough when initializing the instancedsl
- The DSL string to use to retrieve an instanceGet an interceptor reference
interceptorName
- The name of the interceptor to retrieveGet the LogBox reference from the running application
I will return a mock controller object
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 mock and return backclearMethods
- Clear methods on the objectBuilds an empty functioning request context mocked with methods via MockBox. You can also optionally wipe all methods on it
clearMethods
- Clear methods on the objectdecorator
- The class path to the decorator to build into the mock request contextGet the status code set in the CFML engine.
Helper method to deal with ACF2016's overload of the page context response, come on Adobe, get your act together!
Get the render data struct for a ColdBox integration test
Get the rendered content from a ColdBox integration test
Get the RequestContext reference from the running application
Get the status code for a ColdBox integration test
Get the ColdBox global utility class
Get the WireBox reference from the running application
Inspect test case for annotations
Parses a query string into a struct
queryString
- a query string from a URIShortcut method to making a PATCH request through the framework.
route
- The route to execute.params
- Params to pass to the `rc` scope.headers
- Custom headers to pass as from the requestrenderResults
- If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_contentwithExceptionHandling
- If true, then ColdBox will process any errors through the exception handling framework instead of just throwing the error. Default: false.Shortcut method to making a POST request through the framework.
route
- The route to execute.params
- Params to pass to the `rc` scope.headers
- Custom headers to pass as from the requestrenderResults
- If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_contentwithExceptionHandling
- If true, then ColdBox will process any errors through the exception handling framework instead of just throwing the error. Default: false.Process an exception and returns a rendered bug report
controller
- The ColdBox Controllerexception
- The ColdFusion exceptionShortcut method to making a PUT request through the framework.
route
- The route to execute.params
- Params to pass to the `rc` scope.headers
- Custom headers to pass as from the requestrenderResults
- If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_contentwithExceptionHandling
- If true, then ColdBox will process any errors through the exception handling framework instead of just throwing the error. Default: false.Shortcut method to making a request through the framework.
route
- The route to execute.params
- Params to pass to the `rc` scope.headers
- Custom headers to pass as from the requestmethod
- The method type to execute. Defaults to GET.renderResults
- If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_contentwithExceptionHandling
- If true, then ColdBox will process any errors through the exception handling framework instead of just throwing the error. Default: false.Reset the persistence of the unit test coldbox app, basically removes the controller from application scope
clearMethods
decorator
appMapping
coldboxAppKey
configMapping
controller
This executes before any test method for integration tests
setup
in class
testbox.system.compat.framework.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, simulates the URL/FORM.event