Logo: Relish

  1. Sign in

Project: Aruba

Running shell commands

You can run an ad hoc script with the following steps:

  • When I run the following script:

Or you can run shell commands with:

  • I run the following (bash|zsh|...shell)? commands
  • I run the following (bash|zsh|...shell)? commands (in|with) \interpreter``
  • I run the following (bash|zsh|...shell)? commands (in|with) \/path/to/interpreter``
Background
Given
I use a fixture named "cli-app"
Scenarios
Creating and running scripts
Given
a file named "features/shell.feature" with:
Feature: Running scripts
  Scenario: Running ruby script
    When I run the following script:
    """bash
    #!/usr/bin/env ruby

    puts "Hello"
    """
    Then the output should contain exactly "Hello"

  Scenario: Running python script
    When I run the following script:
    """bash
    #!/usr/bin/env python

    print("Hello")
    """
    Then the output should contain exactly "Hello"
When
I run cucumber
Then
the features should all pass
Running shell commands
Given
a file named "features/shell.feature" with:
Feature: Running scripts
  Scenario: Running shell commands
    When I run the following commands:
    """bash
    echo "Hello shell"
    """
    Then the output should contain exactly "Hello shell"
When
I run cucumber
Then
the features should all pass
Running bash commands
Given
a file named "features/shell.feature" with:
Feature: Running scripts
  Scenario: Running bash commands
    When I run the following commands with bash:
    """bash
    echo "Hello echo bash"
    """
    Then the output should contain exactly "Hello bash"
When
I run cucumber
Then
the features should all pass
Running zsh commands
Given
a file named "features/shell.feature" with:
Feature: Running zsh scripts
  Scenario: Running zsh commands
    When I run the following commands with zsh:
    """bash
    echo "Hello, Aruba!"
    """
    Then the output should contain exactly "Hello, Aruba!"
When
I run cucumber
Then
the features should all pass
Running ruby commands
Given
a file named "features/shell.feature" with:
Feature: Running scripts
  Scenario: Running ruby commands
    When I run the following commands with ruby:
    """ruby
    puts "Hello, Aruba!"
    """
    Then the output should contain exactly "Hello, Aruba!"
When
I run cucumber
Then
the features should all pass
Running python commands
Given
a file named "features/shell.feature" with:
Feature: Running scripts
  Scenario: Running ruby commands
    When I run the following commands with python:
    """ruby
    print("Hello, Aruba!")
    """
    Then the output should contain exactly "Hello, Aruba!"
When
I run cucumber
Then
the features should all pass
Running commands if full path to interpreter is given
Given
a file named "features/shell.feature" with:
Feature: Running full path zsh
  Scenario: Running zsh commands #1
    When I run the following commands with /bin/zsh:
    """bash
    echo "Hello, Aruba!"
    """
    Then the output should contain exactly "Hello, Aruba!"

  Scenario: Running zsh commands #1
    When I run the following commands in /bin/zsh:
    """bash
    echo "Hello, Aruba!"
    """
    Then the output should contain exactly "Hello, Aruba!"
When
I run cucumber
Then
the features should all pass
Running commands if only the name of interpreter is given
Given
a file named "features/shell.feature" with:
Feature: Running full path zsh
  Scenario: Running zsh commands #1
    When I run the following commands with zsh:
    """bash
    echo "Hello, Aruba!"
    """
    Then the output should contain exactly "Hello, Aruba!"

  Scenario: Running zsh commands #2
    When I run the following commands in zsh:
    """bash
    echo "Hello, Aruba!"
    """
    Then the output should contain exactly "Hello, Aruba!"
When
I run cucumber
Then
the features should all pass

Last published over 5 years ago by philoserf.