Shell Plugin

The plugin provides functionality to execute commands via Shell.

Installation

Example 1. build.gradle
implementation(group: 'org.vividus', name: 'vividus-plugin-shell', version: '0.5.1')

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.

Example 2. 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 ISO-8601 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`
Example 3. 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`
The saved stdout/stderr are limited to ~2 billions of 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`
Example 4. 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`
The saved stdout/stderr are limited to ~2 billions of characters. But keep in mind depending on run configuration and environment it’s possible to hit memory limits before reaching described output limits.