|
TestBox 2.4.0 | ||||
FRAMES |
railo-context.Componenttestbox.system.BaseSpec
public class BaseSpec
Copyright Since 2005 TestBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- This is a base spec object that is used to test XUnit and BDD style specification methods
Constructor Summary | |
---|---|
remote |
init()
Constructor |
Method Summary | |
---|---|
any |
addAssertions(any assertions)
Add custom assertions to the $assert object |
any |
addMatchers(any matchers)
Add custom matchers to your expectations |
any |
afterEach(any body)
This function is used for BDD test suites to store the afterEach() function to execute for a test suite group |
any |
aroundEach(any body)
This is used to surround a spec with your own closure code to provide a nice around decoration advice |
any |
aroundStub([any spec])
|
any |
assert(any expression, [any message=''])
Assert that the passed expression is true |
any |
beforeEach(any body)
This function is used for BDD test suites to store the beforeEach() function to execute for a test suite group |
any |
clearDebugBuffer()
Clear the debug array buffer |
any |
closureStub()
|
any |
console(any var, [any top='9999'])
Send some information to the console via writedump( output="console" ) |
any |
createEmptyMock([string className], [any object], [boolean callLogging='true'])
Create an empty mock |
any |
createMock([string className], [any object], [boolean clearMethods='false'])
Create a mock with or without clearing implementations, usually not clearing means you want to build object spies |
any |
createStub([boolean callLogging='true'], [string extends=''], [string implements=''])
Create an empty stub object that you can use for mocking |
any |
debug([any var], [string label=''], [boolean deepCopy='false'], [numeric top='999'])
Debug some information into the TestBox debugger array buffer |
any |
describe(string title, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
The way to describe BDD test suites in TestBox |
Expectation |
expect([any actual])
Start an expectation expression |
any |
expectedException([any type=''], [any regex='.*'])
Expect an exception from the testing spec |
any |
fail([any message=''])
Fail an assertion |
any |
feature(string feature, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
The way to describe BDD test suites in TestBox |
any |
generateAroundEachClosuresStack([array closures], any suite, any spec)
Generates a specs stack for executions |
array |
getDebugBuffer()
Get the debug array buffer from scope |
any |
getMockBox([string generationPath])
Get a reference to the MockBox engine |
any |
getProperty(any target, any name, [any scope='variables'], [any defaultValue])
Get a private property |
any |
given(string given, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
The way to describe BDD test suites in TestBox |
boolean |
hasExpectedException(any specName, any runner)
Check if an expected exception is defined |
boolean |
isExpectedException(any exception, any specName, any runner)
Check if the incoming exception is expected or not |
any |
it(string title, any body, [any labels='[runtime expression]'], [any skip='false'], [struct data='[runtime expression]'])
The it() function describes a spec or a test in TestBox |
any |
makePublic(any target, string method, [string newName=''])
Make a private method on a CFC public with or without a new name and returns the target object |
any |
prepareMock([any object], [boolean callLogging='true'])
Prepares an already instantiated object to act as a mock for spying and much more |
any |
print(any message)
Write some output to the ColdFusion output buffer |
any |
println(any message)
Write some output to the ColdFusion output buffer using a attached |
any |
querySim(any queryData)
First line are the query columns separated by commas |
BaseSpec |
runAfterEachClosures(any suite, any spec)
Execute the after each closures in order for a suite and spec |
BaseSpec |
runAroundEachClosures(any suite, any spec)
Execute the around each closures in order for a suite and spec |
BaseSpec |
runBeforeEachClosures(any suite, any spec)
Execute the before each closures in order for a suite and spec |
remote any |
runRemote([string testSpecs=''], [string testSuites=''], [string reporter='simple'], [string labels=''])
Run a test remotely, only useful if the spec inherits from this class |
any |
runSpec(any spec, any suite, any testResults, any suiteStats, any runner)
Run a BDD test in this target CFC |
any |
runTestMethod(any spec, any testResults, any suiteStats, any runner)
Runs a xUnit style test method in this target CFC |
any |
scenario(string scenario, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
The way to describe BDD test suites in TestBox |
private any |
sliceTagContext(any tagContext)
removes the TestBox tag contexts from the beginning of the Failure Origin |
any |
story(string story, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
The way to describe BDD test suites in TestBox |
any |
then(string then, any body, [any labels='[runtime expression]'], [any skip='false'], [struct data='[runtime expression]'])
The then() function describes a spec or a test in TestBox and is an alias for it |
any |
when(string when, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
The way to describe BDD test suites in TestBox |
any |
xdescribe(string title, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'])
This is a convenience method that makes sure the test suite is skipped from execution |
any |
xit(string title, any body, [any labels='[runtime expression]'], [struct data='[runtime expression]'])
This is a convenience method that makes sure the test spec is skipped from execution |
Methods inherited from class railo-context.Component |
---|
|
Constructor Detail |
---|
remote init()
Method Detail |
---|
public any addAssertions(any assertions)
assertions
- The structure of custom assertion functions to register or a path or instance of a CFC containing all the assertion functions to registerpublic any addMatchers(any matchers)
matchers
- The structure of custom matcher functions to register or a path or instance of a CFC containing all the matcher functions to registerpublic any afterEach(any body)
body
- The closure functionpublic any aroundEach(any body)
body
- The closure functionpublic any aroundStub([any spec])
spec
public any assert(any expression, [any message=''])
expression
message
public any beforeEach(any body)
body
- The closure functionpublic any clearDebugBuffer()
public any closureStub()
public any console(any var, [any top='9999'])
var
- The data to sendtop
- Apply a top to the dump, by default it does 9999 levelspublic any createEmptyMock([string className], [any object], [boolean callLogging='true'])
className
- The class name of the object to mock. The mock factory will instantiate it for youobject
- The object to mock, already instantiatedcallLogging
- Add method call logging for all mocked methods. Defaults to truepublic any createMock([string className], [any object], [boolean clearMethods='false'])
className
- The class name of the object to mock. The mock factory will instantiate it for youobject
- The object to mock, already instantiatedclearMethods
- If true, all methods in the target mock object will be removed. You can then mock only the methods that you want to mock. Defaults to falsepublic any createStub([boolean callLogging='true'], [string extends=''], [string implements=''])
callLogging
- Add method call logging for all mocked methods. Defaults to trueextends
- Make the stub extend from certain CFCimplements
- Make the stub adhere to an interfacepublic any debug([any var], [string label=''], [boolean deepCopy='false'], [numeric top='999'])
var
- The data to debuglabel
- The label to add to the debug entrydeepCopy
- By default we do not duplicate the incoming information, but you can :)top
- The top numeric number to dump on the screen in the report, defaults to 999public any describe(string title, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
title
- The name of this test suitebody
- The closure that represents the test suitelabels
- The list or array of labels this suite group belongs toasyncAll
- If you want to parallelize the execution of the defined specs in this suite group.skip
- A flag or a closure that tells TestBox to skip this suite group from testing if true. If this is a closure it must return boolean.public Expectation expect([any actual])
actual
- The actual value, it is not required as it can be null.public any expectedException([any type=''], [any regex='.*'])
type
- The type to expectregex
- Optional exception message regular expression to match, by default it matches .*public any fail([any message=''])
message
public any feature(string feature, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
feature
- The name of this test suitebody
- The closure that represents the test suitelabels
- The list or array of labels this suite group belongs toasyncAll
- If you want to parallelize the execution of the defined specs in this suite group.skip
- A flag or a closure that tells TestBox to skip this suite group from testing if true. If this is a closure it must return boolean.public any generateAroundEachClosuresStack([array closures], any suite, any spec)
closures
- The array of closures data to buildsuite
- The target suitespec
- The target specpublic array getDebugBuffer()
public any getMockBox([string generationPath])
generationPath
- The path to generate the mocks if passed, else uses default location.public any getProperty(any target, any name, [any scope='variables'], [any defaultValue])
target
- The target to get a property fromname
- The name of the property to retrievescope
- The scope to get it from, defaults to 'variables' scopedefaultValue
- A default value if the property does not existpublic any given(string given, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
given
body
- The closure that represents the test suitelabels
- The list or array of labels this suite group belongs toasyncAll
- If you want to parallelize the execution of the defined specs in this suite group.skip
- A flag or a closure that tells TestBox to skip this suite group from testing if true. If this is a closure it must return boolean.public boolean hasExpectedException(any specName, any runner)
specName
runner
public boolean isExpectedException(any exception, any specName, any runner)
exception
specName
runner
public any it(string title, any body, [any labels='[runtime expression]'], [any skip='false'], [struct data='[runtime expression]'])
title
- The title of this specbody
- The closure that represents the testlabels
- The list or array of labels this spec belongs toskip
- A flag or a closure that tells TestBox to skip this spec test from testing if true. If this is a closure it must return boolean.data
- A struct of data you would like to bind into the spec so it can be later passed into the executing body functionpublic any makePublic(any target, string method, [string newName=''])
target
- The target object to expose the methodmethod
- The private method to exposenewName
- If passed, it will expose the method with this name, else just uses the same namepublic any prepareMock([any object], [boolean callLogging='true'])
object
- The object to mock, already instantiatedcallLogging
- Add method call logging for all mocked methods. Defaults to truepublic any print(any message)
message
public any println(any message)
message
public any querySim(any queryData)
queryData
public BaseSpec runAfterEachClosures(any suite, any spec)
suite
- The suite definitionspec
- The spec definitionpublic BaseSpec runAroundEachClosures(any suite, any spec)
suite
- The suite definitionspec
- The spec definitionpublic BaseSpec runBeforeEachClosures(any suite, any spec)
suite
- The suite definitionspec
- The spec definitionremote any runRemote([string testSpecs=''], [string testSuites=''], [string reporter='simple'], [string labels=''])
testSpecs
- A list or array of test names that are the ones that will be executed ONLY!testSuites
- A list or array of suite names that are the ones that will be executed ONLY!reporter
- The type of reporter to run the test withlabels
- A list or array of labels to apply to the testing.public any runSpec(any spec, any suite, any testResults, any suiteStats, any runner)
spec
- The spec definition to testsuite
- The suite definition this spec belongs totestResults
- The testing results objectsuiteStats
- The suite stats that the incoming spec definition belongs torunner
- The runner calling this BDD testpublic any runTestMethod(any spec, any testResults, any suiteStats, any runner)
spec
- The spec definition to testtestResults
- The testing results objectsuiteStats
- The suite stats that the incoming spec definition belongs torunner
- The runner calling this BDD testpublic any scenario(string scenario, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
scenario
body
- The closure that represents the test suitelabels
- The list or array of labels this suite group belongs toasyncAll
- If you want to parallelize the execution of the defined specs in this suite group.skip
- A flag or a closure that tells TestBox to skip this suite group from testing if true. If this is a closure it must return boolean.private any sliceTagContext(any tagContext)
tagContext
- The tag contextpublic any story(string story, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
story
- The name of this test suitebody
- The closure that represents the test suitelabels
- The list or array of labels this suite group belongs toasyncAll
- If you want to parallelize the execution of the defined specs in this suite group.skip
- A flag or a closure that tells TestBox to skip this suite group from testing if true. If this is a closure it must return boolean.public any then(string then, any body, [any labels='[runtime expression]'], [any skip='false'], [struct data='[runtime expression]'])
then
- The title of this specbody
- The closure that represents the testlabels
- The list or array of labels this spec belongs toskip
- A flag or a closure that tells TestBox to skip this spec test from testing if true. If this is a closure it must return boolean.data
- A struct of data you would like to bind into the spec so it can be later passed into the executing body functionpublic any when(string when, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'], [any skip='false'])
when
body
- The closure that represents the test suitelabels
- The list or array of labels this suite group belongs toasyncAll
- If you want to parallelize the execution of the defined specs in this suite group.skip
- A flag or a closure that tells TestBox to skip this suite group from testing if true. If this is a closure it must return boolean.public any xdescribe(string title, any body, [any labels='[runtime expression]'], [boolean asyncAll='false'])
title
- The name of this test suitebody
- The closure that represents the test suitelabels
- The list or array of labels this suite group belongs toasyncAll
- If you want to parallelize the execution of the defined specs in this suite group.public any xit(string title, any body, [any labels='[runtime expression]'], [struct data='[runtime expression]'])
title
- The title of this specbody
- The closure that represents the testlabels
- The list or array of labels this spec belongs todata
- A struct of data you would like to bind into the spec so it can be later passed into the executing body function
|
TestBox 2.4.0 | ||||
FRAMES |