Execution
Execute arbitrary commands on target systems.
Command
Run any executable or bash-cmd on the DUT.
| Attribute | Type | Required | Default | Description |
|---|
cmd | const | Yes | cmd | String that identifies the teststep that gets executed |
name | string | Yes | | Name to uniquely identify the teststep. This name will show up in reports, logs and the WebUI |
transport | TransportObject | Yes | | Defines how the command is executed |
options | OptionsObject | No | | Additional command options |
parameters | CommandOptions | Yes | | Teststep specific parameters |
Command Options
| Attribute | Type | Required | Default | Description |
|---|
executable | string | Yes | | The executable to run |
args | []string | No | | Arguments to pass to the executable |
working_dir | string | No | | The working directory to run the executable in |
expect | []CommandExpectOptions | No | | Expectations to check against the output of the executable |
variable | string | No | | The name of the variable to store stdout |
Command Expect Options
| Attribute | Type | Required | Description |
|---|
regex | string | Yes | Regular expression to match against the output of the executable |
Command Example
cmd: cmd
name: Run echo test
transport: *transport
options:
timeout: 20m
parameters:
executable: "echo"
args:
- "Hello World!"
expect:
- regex: "Hello World!"
variable: helloWorldVar
Shell
Execute shell commands with full shell features including pipes, redirections, command chaining, variable expansion, and globs.
| Attribute | Type | Required | Default | Description |
|---|
cmd | const | Yes | shell | String that identifies the teststep that gets executed |
name | string | Yes | | Name to uniquely identify the teststep. This name will show up in reports, logs and the WebUI |
transport | TransportObject | Yes | | Defines how the command is executed |
options | OptionsObject | No | | Additional command options |
parameters | ShellOptions | Yes | | Teststep specific parameters |
Shell Options
| Attribute | Type | Required | Default | Description |
|---|
command | string | Yes | | The shell command to execute. Supports pipes, redirections, chaining, globs, variable expansion |
shell | string | No | /bin/sh | Path to the shell interpreter (e.g., /bin/bash, /bin/zsh) |
working_dir | string | No | | The working directory to run the command in |
expect | []ShellExpectOptions | No | | Expectations to check against the output of the command |
variable | string | No | | The name of the variable to store stdout |
Shell Expect Options
| Attribute | Type | Required | Description |
|---|
regex | string | Yes | Regular expression to match against the output of the command |
Shell Examples
Using Pipes
cmd: shell
name: Count errors in dmesg
transport: *transport
parameters:
command: "dmesg | grep -i error | wc -l"
variable: error_count
Command Chaining
cmd: shell
name: Build and test
transport: *transport
parameters:
command: "cd /build && make clean && make all"
working_dir: "/workspace"
Custom Shell with Bash Features
cmd: shell
name: Check disk usage
transport: *transport
parameters:
command: "df -h / | tail -1 | awk '{print $5}' | sed 's/%//'"
shell: "/bin/bash"
variable: disk_usage_percent
expect:
- regex: "^[0-9]+$"