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
Context can be set in,
beforeAll
phase of a testbeforeScript
andafterScript
phases of a task
It is not possible to set context in any other phase of a test or a task.
Setting and referencing context
- In TesmonLang
- In Scripts
Referencing
userId: ${{context.user_id}}
Example
actions:
register:
props:
method: POST
body: >-
username=${{context.user_id}}&password=${{context.password}}
...