turbulence
  • About
  • Docs
  • Tutorials
  • Api
  • GitHub
  • Turbulence
  • AverageResponseTime
  • Criteria
  • ElseStep
  • Global
  • HttpResponse
  • IfStep
  • LoopStep
  • SummaryResults
  • TestPlan
  • Listener
  • StepCreator

Turbulence

Turbulence is a variable automatically provided inside of Turbulence test plans. It is the entry point for all tests, and allows test plans to be defined.
  • startUserSteps

    ( ) => TestPlan
    Start a new test.
    Arguments:
    • None

AverageResponseTime

An object allowing configuration of average response time criteria for a test. Returned by the [[Criteria.averageResponseTime]] method
  • greaterThan

    ( time: any ) => this
    Require that the average response times during the test were greater than the specified time.
    Arguments:
    • time: any - The threshold, in milliseconds

  • lessThan

    ( time: any ) => this
    Require that the average response times during the test were less than the specified time.
    Arguments:
    • time: any - The threshold, in milliseconds

Criteria

Allows criteria to be defined that will fail the test if certain thresholds are violated. Injected automatically into the [[TestPlan.breaker]] function.
  • averageResponseTime

    ( ) => any
    Configure the average response time object. Returns an [[AverageResponseTime]] object that allows further configuration.
    Arguments:
    • None

  • predicate

    ( func: ) => void
    A freeform predicate that can evaulate the entire [[SummaryResults]] object that records the executed test plan. The predicate should return either true or false to pass or fail the test respectively.
    Arguments:
    • func: -

ElseStep

Returned from within an If block. Allows alternate steps to be defined if the If predicate evaluates to false.
  • assertResponse

    ( predicate: any ) => StepCreator
    Arguments:
    • predicate: any

  • delete

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • endIf

    ( ) => StepCreator
    End the If statement.
    Arguments:
    • None

  • expectStatus

    ( code: any ) => StepCreator
    Arguments:
    • code: any

  • get

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • head

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • if

    ( predicate: any ) => StepCreator
    Arguments:
    • predicate: any

  • loop

    ( times: number ) => StepCreator
    Arguments:
    • times: number

  • pause

    ( time: number ) => StepCreator
    Arguments:
    • time: number

  • post

    ( url: string , body: any ) => StepCreator
    Arguments:
    • url: string
    • body: any

  • processor

    ( func: any ) => StepCreator
    Arguments:
    • func: any

  • put

    ( url: string , body: any ) => StepCreator
    Arguments:
    • url: string
    • body: any

  • randomPause

    ( lower: number , upper: number ) => StepCreator
    Arguments:
    • lower: number
    • upper: number

Global

A variable holder that can be injected into any function that supports injection. It is used to share variables between virtual users and test plans. Variables can be attached like any normal JS object (e.g. Global.myCustomVariable = 'MyValue';)

HttpResponse

A class containing the http response returned by the server.
  • getBody

    ( ) => any
    Get the body of the http response.
    Arguments:
    • None

  • getStatusCode

    ( ) => number
    Get the status code of the http response as a number.
    Arguments:
    • None

IfStep

  • assertResponse

    ( predicate: any ) => StepCreator
    Arguments:
    • predicate: any

  • delete

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • else

    ( ) => ElseStep
    Steps to execute if the predicate evalutes to false.
    Arguments:
    • None

  • endIf

    ( ) => StepCreator
    End the if statement and return to the parent step chain.
    Arguments:
    • None

  • execute

    ( http: HttpClient , data: any ) => Q.Promise
    Arguments:
    • http: HttpClient
    • data: any

  • expectStatus

    ( code: any ) => StepCreator
    Arguments:
    • code: any

  • get

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • head

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • if

    ( predicate: any ) => StepCreator
    Arguments:
    • predicate: any

  • loop

    ( times: number ) => StepCreator
    Arguments:
    • times: number

  • pause

    ( time: number ) => StepCreator
    Arguments:
    • time: number

  • post

    ( url: string , body: any ) => StepCreator
    Arguments:
    • url: string
    • body: any

  • processor

    ( func: any ) => StepCreator
    Arguments:
    • func: any

  • put

    ( url: string , body: any ) => StepCreator
    Arguments:
    • url: string
    • body: any

  • randomPause

    ( lower: number , upper: number ) => StepCreator
    Arguments:
    • lower: number
    • upper: number

LoopStep

  • assertResponse

    ( predicate: any ) => StepCreator
    Arguments:
    • predicate: any

  • delete

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • endLoop

    ( ) => T
    End the loop and return the parent object.
    Arguments:
    • None

  • execute

    ( http: any ) => Q.Promise
    Arguments:
    • http: any

  • expectStatus

    ( code: any ) => StepCreator
    Arguments:
    • code: any

  • get

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • head

    ( url: string ) => StepCreator
    Arguments:
    • url: string

  • if

    ( predicate: any ) => StepCreator
    Arguments:
    • predicate: any

  • loop

    ( times: number ) => StepCreator
    Arguments:
    • times: number

  • pause

    ( time: number ) => StepCreator
    Arguments:
    • time: number

  • post

    ( url: string , body: any ) => StepCreator
    Arguments:
    • url: string
    • body: any

  • processor

    ( func: any ) => StepCreator
    Arguments:
    • func: any

  • put

    ( url: string , body: any ) => StepCreator
    Arguments:
    • url: string
    • body: any

  • randomPause

    ( lower: number , upper: number ) => StepCreator
    Arguments:
    • lower: number
    • upper: number

SummaryResults

An object maintaining a record of all responses Turbulence received over the course of a test.
  • averageResponseTime

    ( name: string ) => number
    Return the average response time for all requests.
    Arguments:
    • name: string - TODO what does this do?

  • requestMap

    ( ) =>
    Arguments:
    • None

  • responseTimesByTimestamp

    ( ) => any
    Arguments:
    • None

  • responsesPerInterval

    ( interval: any ) => any
    Arguments:
    • interval: any

TestPlan

An individual test plan. It allows steps of the test to be defined in order.
  • arrivalRate

    ( rate: any ) => TestPlan
    How often to create a new user in milliseconds. Cannot be combined with [[concurrentUsers]].
    Arguments:
    • rate: any

  • assertResponse

    ( predicate: any ) => StepCreator
    Arguments:
    • predicate: any

  • breaker

    ( closure: ) => TestPlan
    A function that determines whether or not to 'break' the Turbulence test (by returning a non-zero return code). The function is passed the results object of the run and should return either true or false to indicate if the run was successful or not, respectively.
    Arguments:
    • closure: - The function that configures the build criteria.

  • concurrentUsers

    ( users: number ) => TestPlan
    Set the number of concurrent users to simulate during this test. Use in conjunction with [[rampUpPeriod]] to slowly add load as the test runs. Cannot be combined with [[arrivalRate]]
    Arguments:
    • users: number

  • delete

    ( url: string , headers: string , label: string ) => StepCreator
    Arguments:
    • url: string
    • headers: string
    • label: string

  • duration

    ( millis: any ) => TestPlan
    The duration of the test in milliseconds.
    Arguments:
    • millis: any

  • endUserSteps

    ( ) => Turbulence
    End this test plan and return the main [[Turbulence]] object.
    Arguments:
    • None

  • expectStatus

    ( code: any ) => StepCreator
    Arguments:
    • code: any

  • get

    ( url: string , headers: any , label: string ) => StepCreator
    Arguments:
    • url: string
    • headers: any
    • label: string

  • head

    ( url: string , headers: string , label: string ) => StepCreator
    Arguments:
    • url: string
    • headers: string
    • label: string

  • if

    ( predicate: any ) => IfStep
    Arguments:
    • predicate: any

  • listener

    ( listener: Listener ) => TestPlan
    Add a listener to the test. See the {Listener} interface for information on what fields are necessary.
    Arguments:
    • listener: Listener

  • loop

    ( times: number ) => LoopStep
    Arguments:
    • times: number

  • pause

    ( time: number ) => StepCreator
    Arguments:
    • time: number

  • post

    ( url: string , body: any , headers: any , label: string ) => StepCreator
    Arguments:
    • url: string
    • body: any
    • headers: any
    • label: string

  • processor

    ( func: any ) => StepCreator
    Arguments:
    • func: any

  • put

    ( url: string , body: any , headers: any , label: string ) => StepCreator
    Arguments:
    • url: string
    • body: any
    • headers: any
    • label: string

  • rampUpPeriod

    ( seconds: number ) => TestPlan
    A warm-up period during which new users are slowly added to the performance test. Use in conjunction with [[concurrentUsers]].
    Arguments:
    • seconds: number

  • randomPause

    ( lower: number , upper: number ) => StepCreator
    Arguments:
    • lower: number
    • upper: number

Listener

The interface that listeners must adher to.

StepCreator

The common interface that all step creating 'nodes' implement. These steps will be available when you have just created a [[TestPlan]], entered an if statement, or started a loop.
  • assertResponse

    ( predicate: any ) => StepCreator
    Allows a predicate to be provided that can make an assertino against the [[HttpResponse]] returned in a previous step and return True or False.
    Arguments:
    • predicate: any

  • delete

    ( url: string , label: String ) => StepCreator
    Arguments:
    • url: string
    • label: String

  • expectStatus

    ( code: any ) => StepCreator
    Assert that the Http request returned with the specified status code. If not, this step will be marked as a failure in the report.
    Arguments:
    • code: any - The Http status code to expect as a number

  • get

    ( url: string , label: String ) => StepCreator
    Make an http GET request to the specified Url.
    Arguments:
    • url: string - The url to send the request to.
    • label: String - A label for this request. This is shown in the standard Turbulence Html Reporter. Purely cosmetic.

  • head

    ( url: string , label: String ) => StepCreator
    Arguments:
    • url: string
    • label: String

  • if

    ( predicate: any ) => StepCreator
    Start an [[IfStep]]. An if step evaluates the predicate that is passed in before decided to execute. If the predicate evaluates to false, the contents of the [[IfStep]] will not execute.
    Arguments:
    • predicate: any - The predicate to evaluate. It is passed the result of the last step executed.

  • loop

    ( times: number ) => StepCreator
    Start a loop for the specified number of times. Steps can be chained off of this object until [[LoopStep.endLoop]] is called.
    Arguments:
    • times: number - How many times to execute the contents of the loop.

  • pause

    ( time: number ) => StepCreator
    Pause the test execution for a set number of milliseconds. Only applies to the current 'user'.
    Arguments:
    • time: number - The amount of time to pause in milliseconds.

  • post

    ( url: string , body: any , label: String ) => StepCreator
    Send an Http POST request to the specified Url.
    Arguments:
    • url: string - The url to send the request to.
    • body: any - The body to post.
    • label: String - A label for this request. This is shown in the standard Turbulence Html Reporter. Purely cosmetic.

  • processor

    ( func: any ) => StepCreator
    Arguments:
    • func: any

  • put

    ( url: string , body: any , label: String ) => StepCreator
    Arguments:
    • url: string
    • body: any
    • label: String

  • randomPause

    ( lower: number , upper: number ) => StepCreator
    As [[EmbeddableStepCreator.pause]], except it pauses a random amount of time between the specified lower and upper bonudaries.
    Arguments:
    • lower: number - The lower boundary in milliseconds
    • upper: number - The upper boundary in milliseconds
© Nathan Jenan 2017