#cp.spec.Run.This

A token passed to test functions to allow them to indicate if a test run will complete asynchronously.


#API Overview

Constants - Useful values which cannot be changed

Functions - API calls offered directly by the extension

Constructors - API calls which return an object, typically one that offers API methods

Methods - API calls which can only be made on an object returned by a constructor


#API Documentation

#Constants

Signaturecp.spec.Run.This.state
TypeConstant
DescriptionA collection of states that a Run.This can be in.
Notes
  • States include:
  • running - The Run is currently running and will terminate at the end of the function (synchrnonous).
  • waiting - The Run is waiting, and will terminate when done() is called. (asynchronous).
  • done - The Run is done.
Sourcesrc/extensions/cp/spec/Run.lua line 31

#Functions

Signaturecp.spec.Run.This.defaultTimeout([timeout]) -> number
TypeFunction
DescriptionGets and/or sets the default timeout for asynchronous tests. Defaults to 60 seconds.
Parameters
  • timeout - (optional) the new timeout, in seconds.
Returns
  • The current default timeout, in seconds.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 48

#Constructors

Signaturecp.spec.Run.This(run, actionFn, index) -> cp.spec.Run.This
TypeConstructor
DescriptionCreates a new Run.This instance for a Run.
Parameters
  • run - The Run.
  • actionFn - The action function to execute.
  • index - The index of the action in the current phase.
Returns
  • The new Run.This.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 64

#Methods

Signaturecp.spec.Run.This:abort([message]) -> boolean
TypeMethod
DescriptionIndicates the stage has aborted.
Parameters
  • message - The optional message to output.
Returns
  • A boolean
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 403

Signaturecp.spec.Run.This:cleanup()
TypeMethod
DescriptionCleans up This after a step.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 489

Signaturecp.spec.Run.This:done()
TypeMethod
DescriptionIndicates that the test is completed.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 346

Signaturecp.spec.Run.This:expectAbort([messagePattern]) -> Run.This
TypeMethod
DescriptionIndicates that this spec is expecting an abort/error to occur.
Parameters
  • messagePattern - The pattern to check the fail message against. If not provided, any message will match.
Returns
  • The same Run.This instance.
Notes
  • When this is expected, it doesn't log the problem as a 'fail'. In fact, if the it doesn't occur at some point during the run, it will raise a failure at the end of the run.
  • The messagePattern can be used to ensure it's the fail you expect.
  • This should be called before the actual abort/error would occur.
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 207

Signaturecp.spec.Run.This:expectFail([messagePattern]) -> Run.This
TypeMethod
DescriptionIndicates that this spec is expecting an assert/fail to occur.
Parameters
  • messagePattern - The pattern to check the fail message against. If not provided, any message will match.
Returns
  • The same Run.This instance.
Notes
  • When this is expected, it doesn't log the problem as a 'fail'. In fact, if the fail doesn't occur, it will raise a failure at the end of the run.
  • The messagePattern can be used to ensure it's the fail you expect.
  • This should be called before the actual assert/fail would occur.
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 120

Signaturecp.spec.Run.This:fail([message]) -> boolean
TypeMethod
DescriptionIndicates the run has failed.
Parameters
  • message - The optional message to output.
Returns
  • A boolean
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 427

Signaturecp.spec.Run.This:isActive() -> boolean
TypeMethod
DescriptionChecks if the this is in an active state - either running or waiting.
Parameters
  • None
Returns
  • true if isActive.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 295

Signaturecp.spec.Run.This:isDone() -> boolean
TypeMethod
DescriptionReturns true if this is done.
Parameters
  • None
Returns
  • A boolean
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 390

Signaturecp.spec.Run.This:isWaiting() -> boolean
TypeMethod
DescriptionChecks if the Run is waiting for this execution to complete via the done method.
Parameters
  • None
Returns
  • true if the waiting.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 333

Signaturecp.spec.Run.This:log(message[, ...])
TypeMethod
DescriptionWhen the current Run is in debug mode, output the message to the console.
Parameters
  • message - the text message to output.
  • ... - optional parameters, to be injected into the message, ala string.format.
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 713

Signaturecp.spec.Run.This:prepare()
TypeMethod
DescriptionPrepares this to run.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 477

Signaturecp.spec.Run.This:run() -> cp.spec.Run
TypeMethod
DescriptionReturns the current Run
Parameters
  • None
Returns
  • Returns the current Run
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 86

Signaturecp.spec.Run.This:toObserver([onNext[, onError[, onCompleted]]) -> cp.rx.Observer
TypeMethod
DescriptionCreates an Observer.
Parameters
  • onNext - The next handler.
  • onError - The error handler.
  • onCompleted - The completed handler.
Returns
  • cp.rx.Observer
Notes
  • If the onNext/onError/onCompleted functions are
  • not provided, then it will provide defaults. onNext will be logged, onError will throw an error,
  • and onCompleted will trigger done.
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 272

Signaturecp.spec.Run.This:wait([timeout]) -> none
TypeMethod
DescriptionIndicates that the test is continuing asynchronously, and will be completed by calling done.
Parameters
  • timeout - (optional) The number of seconds to wait before timing out.
Returns
  • None
Notes
ExamplesNone
Sourcesrc/extensions/cp/spec/Run.lua line 308