Skip to main content

Shell Script Step

The Run Shell Script step executes a shell script as part of a test case — Batch, Bash or PowerShell.

When to Use​

  • Running setup or teardown scripts.
  • Calling external tools (e.g. curl, database CLIs, deployment tools).
  • File-system operations (cleanup, archive, move files).
  • Triggering external processes in an integration test.

Why: Some test setup is easier (or only possible) outside the Aethrix engine — seeding infrastructure, invoking CLIs, or cleaning state. The shell step runs these with the same variable and assertion model as the rest of your suite.

Quickest Scenario​

  1. Add a Run Shell Script step.
  2. Choose the Type of Shell Script: PowerShell (cross-platform), Windows Batch (Windows only) or Bash (Linux/macOS).
  3. Type the script in the Shell Script editor. Use ${VariableName} for substitution.
  4. Run. Standard Output and Error Output appear in the right-hand tabs.
warning

Batch can only run on Windows; Bash only on Linux/macOS; PowerShell is cross-platform. The step validates the platform before running and fails with a PlatformNotSupportedException otherwise.

Configuration​

FieldDescription
Type of Shell ScriptPowerShell, Windows Batch or Bash.
TimeoutMaximum run time of the script (default 00:02:00). The process is killed on expiry and the step fails.
Error output as FailedWhen on, any content written to the error stream fails the step.
Working DirectoryFixed to the project path.
Shell ScriptThe script body (code editor). Variables are substituted before execution.
Script OutputTwo tabs — Standard Output and Error Output (read-only).

Parameter Reference​

PropertyDescription
ContentThe script text. Supports ${VariableName} substitution. Assertion target.
BatchTypeBatchType.PowerShell, .WindowsBatch or .Bash.
StandardOutputCaptured stdout (DefaultAssertionTargetProperty).
ErrorOutputCaptured error stream.
ErrorOutputAsFailedtrue (default) — fail the step if error output is non-empty.
TimeOutTimeSpan maximum run time (default 2 minutes).
tip

Because StandardOutput and Content are assertion targets (AssertionStepBase), you can assert directly on the script's output — for example, assert that stdout contains healthy.

Examples​

Windows (PowerShell)​

Type: PowerShell
Content:
.\scripts\seed-database.ps1 -ConnectionString "${DbConnection}"

Linux / macOS (Bash)​

Type: Bash
Content:
curl -s ${BaseUrl}/health | grep -q OK && echo 'healthy' > /tmp/status.txt

Cross-Platform (.NET CLI)​

Type: PowerShell
Content:
dotnet test ../MyProject.Tests --filter "Category=Smoke"

Security Notes​

  • Commands run with the same privileges as Aethrix Studio.
  • Avoid hardcoding credentials — use ${VariableName} and mark them as password parameters where possible.
  • In CI/CD, ensure the agent has the required interpreter/executable in PATH.

See Also​