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
Prefer timeout tuning
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.
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.