Shell Plugin
The plugin provides functionality to execute commands via Shell.
Installation
implementation(group: 'org.vividus', name: 'vividus-plugin-shell', version: '0.5.7')
Properties
You are allowed to define a custom shell using properties:
-
shell.<shell-key>.executable
- The executable file. -
shell.<shell-key>.option
- The command option.
Where <shell-key>
is the key which will be used to select a shell for the commands execution.
shell.ksh.executable=ksh
shell.ksh.option=-c
Name | Acceptable values | Default | Description |
---|---|---|---|
|
<string> |
The key of the shell which will be used for commands execution. By default, VIVIDUS picks the shell depending on the operating system:
. Out of the box VIVIDUS supports |
|
|
The timeout in ISO-8601 Durations format. |
PT5M |
The timeout duration to wait for command execution finish. |
Steps
Execute shell commands
When I execute command `$command` and save result to $scopes variable `$variableName`
-
$command
- The command to execute, it should follow the syntax of the currently active shell. -
$variableName
- The variable name to store the command execution results. The data will be stored under the following keys:-
$variableName.stdout
- the content of the command standard output stream; -
$variableName.stderr
- the content of the command standard error stream; -
$variableName.exit-code
- the exit code of the command.
-
When I execute command `echo 'Hello World!'` and save result to scenario variable `result`
Then `${result.stdout}` is equal to `Hello World!`
Then `${result.stderr}` is equal to ``
Then `${result.exit-code}` is equal to `0`
The saved stdout/stderr are limited to ~2 billion characters. But keep in mind depending on run configuration and environment it’s possible to hit memory limits before reaching described output limits. |
Execute shell commands using specific shell
When I execute command `$command` using $shellName and save result to $scopes variable `$variableName`
-
$command
- The command to execute, it should follow the syntax of the shell defined under theshellKey
. -
$shellKey
- The key of the shell which will be used for commands execution. -
$variableName
- The variable name to store the command execution results. The data will be stored under the following keys:-
$variableName.stdout
- the content of the command standard output stream; -
$variableName.stderr
- the content of the command standard error stream; -
$variableName.exit-code
- the exit code of the command.
-
When I execute command `echo 'Hello World!'` using PowerShell and save result to scenario variable `result`
Then `${result.stdout}` is equal to `Hello World!`
Then `${result.stderr}` is equal to ``
Then `${result.exit-code}` is equal to `0`
The saved stdout/stderr are limited to ~2 billion characters. But keep in mind depending on run configuration and environment it’s possible to hit memory limits before reaching described output limits. |