Contents

Interactive process control

@announce

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

Scenario: Running ruby interactively

@ssh_remote

  • Given the file "echo.rb" contains:
    ruby
    while res = gets.chomp
      break if res == "quit"
      puts res.reverse
    end
  • When I interactively run `ruby echo.rb`
  • And I type "hello, world"
  • And I type "quit"
  • Then the output contains:
    text
    dlrow ,olleh

Scenario: Running a native binary interactively

  • When I interactively run `bc -q`
  • And I type "4 + 3"
  • And I type "quit"
  • Then the output should contain:
    text
    7

Scenario: Running interactively in a directory outside Aruba's scratch

  • When I interactively run `echo 'correct' >discovered.txt` in "/tmp"
  • When I run `cat /tmp/discovered.txt`
  • Then the output contains:
    text
    correct
  • And the file "discovered.txt" does not exist

Scenario: Running successfully in a directory outside Aruba's scratch

  • When I successfully run `echo 'correct2' >discovered.txt` in "~/tmp/"
  • When I run `cat ~/tmp/discovered.txt`
  • Then the output contains:
    text
    correct2
  • And the file "discovered.txt" does not exist

Scenario: Stop processes before checking for filesystem changes

  • Given a directory named "rename_me"
  • When I interactively run `mv rename_me renamed`
  • Then a directory named "renamed" should exist
  • And a directory named "rename_me" should not exist

Source: features/command_examples/interactive.feature at commit efec2546, Cuken (Apache-2.0 license).