Wait & Execute Script
And wait for {int} secondsโ
Pauses test execution for a fixed number of seconds. Useful when your pipeline has a known processing lag and you want to give it time before asserting output.
And wait for 5 seconds
Hard waits make tests slow and brittle. Where possible, use consumerReadTimeout in your assertion step instead.
When script is executedโ
Executes a shell or any shebang-compatible script as part of your test scenario. KTestify reads the script's shebang line to determine the interpreter and runs it via ProcessBuilder, inheriting stdout/stderr.
When script is executed
| scriptPath | scriptArgs |
| ./scripts/reset.sh | arg1,arg2,arg3 |
| Column | Type | Required | Description |
|---|---|---|---|
scriptPath | string | โ | Path to the script file (absolute or relative to working directory) |
scriptArgs | string | โ | Comma-separated argument list passed to the script |
The step fails if the script exits with a non-zero exit code.
Multiple scripts in one stepโ
Add multiple rows to run several scripts in sequence, in row order. Execution fails fast, the step stops at the first script that exits non-zero:
When script is executed
| scriptPath | scriptArgs |
| ./scripts/step-1.sh | |
| ./scripts/step-2.sh | arg1 |
There is no topic concept for script steps, so no same-topic guard rail applies here (unlike producer/assertion steps, see Multi-row DataTables).
Example : trigger a downstream reset before consumingโ
Scenario: Processed orders appear after reset
When script is executed
| scriptPath |
| ./scripts/reset-app.sh |
And wait for 2 seconds
Then expected record from file
| topicAlias | file |
| orders-out | expected.json |
Also available as And execute scriptโ
And execute script
| scriptPath | scriptArgs |
| ./check.sh | param1,param2 |
This form is syntactically identical, When vs And is Gherkin convention only.