Skip to content

Latest commit

 

History

History
107 lines (82 loc) · 4.04 KB

plugin-shell.adoc

File metadata and controls

107 lines (82 loc) · 4.04 KB

Shell Plugin

The plugin provides functionality to execute commands via Shell.

Installation

build.gradle
implementation(group: 'org.vividus', name: 'vividus-plugin-shell', version: '{current-version}')

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.

Configure custom shell
shell.ksh.executable=ksh
shell.ksh.option=-c
Name Acceptable values Default Description

shell.active-shell-key

<string>

The key of the shell which will be used for commands execution. By default, VIVIDUS picks the shell depending on the operating system: . Windows - powershell . Mac OS - zsh . Linux - bash

Out of the box VIVIDUS supports cmd, powershell, sh, zsh, bash.

shell.command-execution-timeout

The timeout in {durations-format-link} 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.

  • $scopes - The comma-separated set of the variables scopes.

  • $variableName - The variable name to store the command execution results. The data will be stored under the following keys:

Execute shell 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`
Note
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 the shellKey.

  • $shellKey - The key of the shell which will be used for commands execution.

  • $scopes - The comma-separated set of the variables scopes.

  • $variableName - The variable name to store the command execution results. The data will be stored under the following keys:

Execute PowerShel 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`
Note
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.