Script Node
The Script Node allows you to run arbitrary JavaScript code at any point in your test flow. This is a powerful tool for performing custom logic that doesn’t fit into other node types.
Use Cases
- Custom Data Preparation: Generating complex data structures or performing calculations and storing the results in context variables.
- Complex Validation: Performing validation logic that is too complex for standard assertions.
- Conditional Logic: Setting context variables that can be used to control the flow of execution in
IForLoopnodes. - External Integrations: Making calls to external libraries or services (if available in the execution environment).
Configuration
The Script Node’s configuration consists of the ScriptCode object, which typically includes:
code: A string containing the JavaScript code to be executed.language: The scripting language (e.g., JavaScript).
The script has access to the full test context, allowing it to read and write variables.