#cp.spec.Run
An individual run of a test Definition or Specification.
#Submodules
#API Overview
Constructors - API calls which return an object, typically one that offers API methods
Fields - Variables which can only be accessed from an object returned by a constructor
Methods - API calls which can only be made on an object returned by a constructor
- debug
- expectAbort
- expectFail
- isDebugging
- isExpectingAbort
- isExpectingFail
- log
- onBefore
- onBfter
- onRunning
- parent
- verbose
#API Documentation
#Constructors
Signature | cp.spec.Run(name, source) -> cp.spec.Run |
Type | Constructor |
Description | Creates a new test run. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 573 |
#Fields
Signature | cp.spec.Run.phase <cp.spec.Run.phase> |
Type | Field |
Description | The current phase of the run. |
Notes | None |
Source | src/extensions/cp/spec/Run.lua line 612 |
Signature | cp.spec.Run.report <cp.spec.Report> |
Type | Field |
Description | The reports of the run. |
Notes | None |
Source | src/extensions/cp/spec/Run.lua line 585 |
Signature | cp.spec.Run.result <cp.spec.Run.result> |
Type | Field |
Description | The current result. Defaults to Run.result.passing . |
Notes | None |
Source | src/extensions/cp/spec/Run.lua line 617 |
Signature | cp.spec.Run.shared <table> |
Type | Field |
Description | The set of data shared by all phases of the Run. Data from parent Runs will also be available. |
Notes | None |
Source | src/extensions/cp/spec/Run.lua line 600 |
Signature | cp.spec.Run.source |
Type | Field |
Description | The object that initiated the run. Typically a Definition. |
Notes | None |
Source | src/extensions/cp/spec/Run.lua line 593 |
#Methods
Signature | cp.spec.Run:debug() -> cp.spec.Run |
Type | Method |
Description | Enables debugging on this Run . Any calls to [#log] will be output to the console. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 670 |
Signature | cp.spec.Run:expectAbort([messagePattern]) -> Run |
Type | Method |
Description | Indicates that this spec is expecting an abort/error to occur. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 186 |
Signature | cp.spec.Run:expectFail([messagePattern]) -> Run |
Type | Method |
Description | Indicates that this spec is expecting an assert/fail to occur. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 99 |
Signature | cp.spec.Run:isDebugging() -> boolean |
Type | Method |
Description | Checks if debug has been enabled on this or any parent Run . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 684 |
Signature | cp.spec.Run:isExpectingAbort() -> boolean, string or nil |
Type | Method |
Description | Checks if the run is expecting a abort/error to occur. If so, it will return the expected message pattern as the second value, if specified. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 226 |
Signature | cp.spec.Run:isExpectingFail() -> boolean, string or nil |
Type | Method |
Description | Checks if the run is expecting a fail to occur. If so, it will return the expected message pattern, if specified. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 139 |
Signature | cp.spec.Run:log(message[, ...]) |
Type | Method |
Description | When the current Run is in debug mode, output the message to the console. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 697 |
Signature | cp.spec.Run:onBefore(actionFn) -> self |
Type | Method |
Description | Adds a callback function to run prior to executing the actual test. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 885 |
Signature | cp.spec.Run:onBfter(actionFn) -> self |
Type | Method |
Description | Adds a callback function to run after to executing the actual test, pass or fail. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 911 |
Signature | cp.spec.Run:onRunning(actionFn) -> self |
Type | Method |
Description | Adds a callback function to run during the test. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 898 |
Signature | cp.spec.Run:parent([parent]) -> cp.spec.Run |
Type | Method |
Description | Gets and/or sets the parent Run for this run. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 838 |
Signature | cp.spec.Run:verbose([isVerbose]) -> boolean | self |
Type | Method |
Description | Either sets the verbose value and returns itself for further chaining, or returns the current verbose status. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/spec/Run.lua line 862 |