Logo: Relish

  1. Sign in

Project: Aruba 0.11.0

Running an interactive command

In order to test interactive command line applications
As a developer using Cucumber
I want to use the interactive session steps

Background
Given
I use a fixture named "cli-app"
Scenarios
  • @wip-jruby-java-1.6
Running ruby interactively
Given
an executable named "bin/cli" with:
#!/usr/bin/env ruby

while res = gets.chomp
  break if res == "quit"
  puts res.reverse
end
And
a file named "features/interactive.feature" with:
Feature: Run command
  Scenario: Run command
    When I run cli interactively
    And I type "hello, world"
    And I type "quit"
    Then it should pass with "dlrow ,olleh"
When
I run cucumber
Then
the features should all pass
  • @posix
Running a native binary interactively
Given
a file named "features/interactive.feature" with:
Feature: Run command
  Scenario: Run command
  When I run cat interactively
  And I type "Hello, world"
  And I type ""
  Then the output should contain "Hello, world"
When
I run cucumber
Then
the features should all pass
  • @posix
Pipe in a file
Given
a file named "features/interactive.feature" with:
Feature: Run command
  Scenario: Run command
    Given a file named "test.txt" with "line1\nline2"
    When I run cat interactively
    And I pipe in the file "test.txt"
    Then the output should contain "line1\nline2"
When
I run cucumber
Then
the features should all pass
  • @posix
Close stdin stream
Given
a file named "features/interactive.feature" with:
Feature: Run command
  Scenario: Run command
    When I run cat interactively
    And I type "Hello, world"
    And I close the stdin stream
    Then the output should contain "Hello, world"
When
I run cucumber
Then
the features should all pass
  • @posix
All processes are stopped before checking for filesystem changes
Given
a file named "features/interactive.feature" with:
Feature: Run command
  Scenario: Run command
    Given a directory named "rename_me"
    When I run mv rename_me renamed interactively
    Then the directory "renamed" should exist
    And the directory "rename_me" should not exist
When
I run cucumber
Then
the features should all pass

Last published over 5 years ago by Max Meyer.