Tag

This component is used to dynamically tag the resulting document of a test execution. You can easily find a document by searching for the specific tag, in the same way you can find a test by searching for the tag you assigned to it. In the composer you will have the ‘tag’ component as option to be added. In this way, you can add different tags based on dynamic events happening during the test execution, such as a certain value retrieved in the payload. You can assign multiple tags to each test by adding more ‘tag’ components to it. Parameters:

Name

Type/Value

Required

Value String

Yes

Another way to add a tag to your test is in the test details screen during test definition or edit. tag Static tags will be displayed in the tests list. All tags, dynamic and static will mark the test execution documents. In the project dashboard, you have the ability to filter events by tags. There is also a dedicated API that does the same. For more info please see the documentation here

While

Allows you to run a block of assertions as long as a condition is valid. Parameters:
Name Type/Value Required
Expression Expression Yes
Expression: The condition that has to be met for the assertions block to be executed  

Flow (Pause or Stop a Test)

This component allows you to pause or stop a test entirely. Parameters:
Name Type/Value Required
Command ‘stop’, ‘wait’ Yes
Value (depends on ‘Command = wait’) Number Yes
Command: This parameter defines the action you want to take. ‘Stop’ will stop the test. ‘Wait’ will pause the test for a number of milliseconds defined in the ‘Value’ parameter. Value: The number of milliseconds you want to pause the test for.   This component is especially useful when combined with the “If” component. See the examples below: If the statusCode is not ‘200’, the test will be halt; none of the remaining assertions will be checked. In this example, the test will wait 1000 milliseconds before performing the GET request.  

Each

Allows you to iterate over a collection of elements and execute the piece of code for each element. Parameters:
Name Type/Value Required
Expression Expression Yes
Expression: The path of the collection you want to iterate on. See Expression for more details.   for each ‘legs’ collection checks if ‘vector’ item is an integer value. If a collection is nested in another one, you need to refer to them as _1, _2, and so on.   for each payload.content.flights collection checks if ‘price.amount’ is an integer and then, for each legs array (that is a nested collection in the flights collection) checks if vector item is an integer value.    

If

Allows you to run a specific piece of code only if a specific condition is met. Parameters:
Name Type/Value Required
Expression Expression Yes
Expression: The condition that evaluates if the code must be executed or not. Examples: if payload.success is equal to true then the code within the element is executed, otherwise is skipped. if _1.intermediate exists then the code within the element is executed, otherwise is skipped. This is useful when the element is not always present.

Set

Allows you to set a variable for future uses in the test. For example,  you can save a value retrieved from the response and use it in a subsequent call. Parameters:
Name Type/Value Required
Var String Yes
Variable mode ‘String’, ‘Data’, ‘Language’ Yes
Value (depends on ‘Variable mode = string’) String Yes
Data (depends on ‘Variable mode = data’) Data Yes
Lang (depends on ‘Variable mode = language’) ‘Groovy’ Yes
Content (depends on ‘Variable mode = language’) Data Yes
Var: artistId Variable mode: String Value: _1.id
  Var: sobjects Variable mode: Data Data: payload.findAll {it.name == ‘bananas’} Var: queries Variable mode: Language Lang: Groovy Content: if (payload.id>100) return ‘furniture’