Skip to main content

Context

Context refers to the execution state of a test and can be used to save and retrieve data during the test's runtime. It is unique to each test and is not available outside of its runtime. Context is a dictionary and can be set and referenced by a script during various phases of a test and a task. However, it is important to note that context set during one phase of a task cannot be referenced in a different phase of the same task.

info

Every task output is automatically stored in the context so that it can be used by consecutive tasks.

context.last_output.<key-1>.<key-2>
info

Context can be set in,

  • beforeAll phase of a test
  • beforeScript and afterScript phases of a task

Get context

statusCode: ${{context.last_output.statusCode}}

userId: ${{context.user_id}}

Example

actions:
register:
props:
method: POST
baseUrl: https://api.tesmon.io
path: /v1/workspaces/${{context.last_output.body.id}}
body: >-
username=${{context.user_id}}&password=${{context.password}}
...