From 19233d81b6026e5c864fbd752cac5f2bf0de836e Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 06:58:16 +0100 Subject: [PATCH 01/25] Remove obsolete step definitions --- features/step_definitions/aruba_dev_steps.rb | 32 -------------------- 1 file changed, 32 deletions(-) diff --git a/features/step_definitions/aruba_dev_steps.rb b/features/step_definitions/aruba_dev_steps.rb index 4884eef04..2e40c820d 100644 --- a/features/step_definitions/aruba_dev_steps.rb +++ b/features/step_definitions/aruba_dev_steps.rb @@ -1,30 +1,3 @@ -When /^I do aruba (.*)$/ do |aruba_step| - @aruba_exception = StandardError.new - - begin - step(aruba_step) - rescue => e - @aruba_exception = e - end -end - -# Useful for debugging timing problems -When /^sleep (\d+)$/ do |time| - sleep time.to_i -end - -When /^I set env variable "(\w+)" to "([^"]*)"$/ do |var, value| - ENV[var] = value -end - -Then /^aruba should fail with "([^"]*)"$/ do |error_message| - expect(@aruba_exception.message).to include sanitize_text(error_message) -end - -Then /^the following step should fail with Spec::Expectations::ExpectationNotMetError:$/ do |multiline_step| - expect { steps multiline_step.to_s }.to raise_error(RSpec::Expectations::ExpectationNotMetError) -end - Given(/^the default executable$/) do step 'an executable named "bin/aruba-test-cli" with:', <<-EOS #!/usr/bin/env ruby @@ -49,8 +22,3 @@ EOS ) end - -Then(/^aruba should be installed on the local system$/) do - run_command('gem list aruba') - expect(last_command_started).to have_output(/aruba/) -end From 18305e8be2ba0910ce7b3184784c512e71e0537b Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 07:19:57 +0100 Subject: [PATCH 02/25] Remove non-feature Something that doesn't work is a bug, not a feature. --- .../steps/command/stop_command.feature | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature index 9a7209df7..ecc961a9c 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature @@ -246,39 +246,6 @@ Feature: Stop commands When I run `cucumber` Then the features should all pass - @requires-ruby-platform-java - Scenario: STDERR/STDOUT is empty on JRUBY if output was written in "signal"-handler - Given an executable named "bin/aruba-test-cli1" with: - """bash - #!/bin/bash - - function term { - echo 'Hello, TERM' - exit 100 - } - - trap term TERM - echo "Hello, Aruba!" - while [ true ]; do sleep 1; done - exit 1 - """ - And a file named "features/stop.feature" with: - """ - Feature: Run it - Scenario: Run command - Given the default aruba exit timeout is 1 second - And I wait 2 seconds for a command to start up - When I run `aruba-test-cli1` in background - And I terminate the command started last - Then the exit status should be 100 - And the output should not contain: - \"\"\" - Hello, TERM - \"\"\" - """ - When I run `cucumber` - Then the features should all pass - @unsupported-on-platform-java Scenario: STDERR/STDOUT is written normally if output was written in "signal"-handler Given an executable named "bin/aruba-test-cli1" with: @@ -311,4 +278,3 @@ Feature: Stop commands """ When I run `cucumber` Then the features should all pass - From b0d304930a87a909701561513068bb4b2f1e5f9d Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 07:36:07 +0100 Subject: [PATCH 03/25] Use smaller values to demonstrate timeout --- features/02_configure_aruba/basics.feature | 24 +++++++++---------- .../02_configure_aruba/exit_timeout.feature | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/features/02_configure_aruba/basics.feature b/features/02_configure_aruba/basics.feature index 4ce5c4b97..a9ab16c3d 100644 --- a/features/02_configure_aruba/basics.feature +++ b/features/02_configure_aruba/basics.feature @@ -24,7 +24,7 @@ Feature: Usage of configuration Given a file named "spec/support/aruba_config.rb" with: """ruby Aruba.configure do |config| - config.exit_timeout = 1 + config.exit_timeout = 0.1 end """ And a file named "spec/usage_configuration_spec.rb" with: @@ -38,7 +38,7 @@ Feature: Usage of configuration end context 'when slow command' do - before(:each) { run_command('aruba-test-cli 2') } + before(:each) { run_command('aruba-test-cli 0.2') } it { expect(last_command_started).not_to be_successfully_executed } end end @@ -55,7 +55,7 @@ Feature: Usage of configuration Given a file named "spec/support/aruba_config.rb" with: """ruby Aruba.configure do |config| - config.exit_timeout = 1 + config.exit_timeout = 0.1 end """ And a file named "spec/support/hooks.rb" with: @@ -64,7 +64,7 @@ Feature: Usage of configuration config.before :each do |example| next unless example.metadata.key? :slow_command - aruba.config.exit_timeout = 5 + aruba.config.exit_timeout = 0.3 end end """ @@ -79,12 +79,12 @@ Feature: Usage of configuration end context 'when slow command and this is known by the developer', :slow_command => true do - before(:each) { run_command('aruba-test-cli 2') } + before(:each) { run_command('aruba-test-cli 0.2') } it { expect(last_command_started).to be_successfully_executed } end context 'when slow command, but this might be a failure' do - before(:each) { run_command('aruba-test-cli 2') } + before(:each) { run_command('aruba-test-cli 0.2') } it { expect(last_command_started).not_to be_successfully_executed } end end @@ -96,7 +96,7 @@ Feature: Usage of configuration Given a file named "features/support/aruba_config.rb" with: """ruby Aruba.configure do |config| - config.exit_timeout = 1 + config.exit_timeout = 0.1 end """ And a file named "features/run.feature" with: @@ -107,7 +107,7 @@ Feature: Usage of configuration Then the exit status should be 0 Scenario: Slow command - When I run `aruba-test-cli 2` + When I run `aruba-test-cli 0.2` Then the exit status should be 128 """ When I run `cucumber` @@ -122,13 +122,13 @@ Feature: Usage of configuration Given a file named "features/support/aruba_config.rb" with: """ruby Aruba.configure do |config| - config.exit_timeout = 1 + config.exit_timeout = 0.1 end """ And a file named "features/support/hooks.rb" with: """ruby Before '@slow-command' do - aruba.config.exit_timeout = 5 + aruba.config.exit_timeout = 0.3 end """ And a file named "features/usage_configuration.feature" with: @@ -140,11 +140,11 @@ Feature: Usage of configuration @slow-command Scenario: Slow command known by the developer - When I run `aruba-test-cli 2` + When I run `aruba-test-cli 0.2` Then the exit status should be 0 Scenario: Slow command which might be a failure - When I run `aruba-test-cli 3` + When I run `aruba-test-cli 0.2` Then the exit status should be 128 """ When I run `cucumber` diff --git a/features/02_configure_aruba/exit_timeout.feature b/features/02_configure_aruba/exit_timeout.feature index 186f4f3cc..cfa35aca4 100644 --- a/features/02_configure_aruba/exit_timeout.feature +++ b/features/02_configure_aruba/exit_timeout.feature @@ -24,12 +24,12 @@ Feature: Configure timeout for command execution Given an executable named "bin/aruba-test-cli" with: """bash #!/bin/bash - sleep 1 + sleep 0.1 """ And a file named "features/support/aruba_config.rb" with: """ruby Aruba.configure do |config| - config.exit_timeout = 2 + config.exit_timeout = 0.2 end """ And the default feature-test @@ -39,12 +39,12 @@ Feature: Configure timeout for command execution Given an executable named "bin/aruba-test-cli" with: """ruby #!/bin/bash - sleep 2 + sleep 0.2 """ And a file named "features/support/aruba_config.rb" with: """ruby Aruba.configure do |config| - config.exit_timeout = 1 + config.exit_timeout = 0.1 end """ And the default feature-test From 4f7048ac9ecf4e0ccea1afcd0a53c0cd459371d6 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 07:53:49 +0100 Subject: [PATCH 04/25] Remove confusing dev steps The step names mentioning 'default executable' and 'default feature' are unclear and therefore confusing. Better to write out the needed executable and feature in place. --- .../02_configure_aruba/exit_timeout.feature | 36 +++++++++++-------- .../working_directory.feature | 9 +++-- features/step_definitions/aruba_dev_steps.rb | 24 ------------- 3 files changed, 29 insertions(+), 40 deletions(-) delete mode 100644 features/step_definitions/aruba_dev_steps.rb diff --git a/features/02_configure_aruba/exit_timeout.feature b/features/02_configure_aruba/exit_timeout.feature index cfa35aca4..000d671bd 100644 --- a/features/02_configure_aruba/exit_timeout.feature +++ b/features/02_configure_aruba/exit_timeout.feature @@ -6,6 +6,12 @@ Feature: Configure timeout for command execution Background: Given I use the fixture "cli-app" + And an executable named "bin/aruba-test-cli" with: + """bash + #!/bin/bash + trap "exit 128" SIGTERM SIGINT + sleep $* + """ Scenario: Default value Given a file named "features/support/aruba_config.rb" with: @@ -21,32 +27,34 @@ Feature: Configure timeout for command execution """ Scenario: Modify value - Given an executable named "bin/aruba-test-cli" with: - """bash - #!/bin/bash - sleep 0.1 - """ - And a file named "features/support/aruba_config.rb" with: + Given a file named "features/support/aruba_config.rb" with: """ruby Aruba.configure do |config| config.exit_timeout = 0.2 end """ - And the default feature-test + And a file named "features/run.feature" with: + """ + Feature: Run it + Scenario: Fast command + When I run `aruba-test-cli 0.1` + Then the exit status should be 0 + """ Then I successfully run `cucumber` Scenario: Fails if takes longer - Given an executable named "bin/aruba-test-cli" with: - """ruby - #!/bin/bash - sleep 0.2 - """ - And a file named "features/support/aruba_config.rb" with: + Given a file named "features/support/aruba_config.rb" with: """ruby Aruba.configure do |config| config.exit_timeout = 0.1 end """ - And the default feature-test + And a file named "features/run.feature" with: + """ + Feature: Run it + Scenario: Fast command + When I run `aruba-test-cli 0.2` + Then the exit status should be 0 + """ Then I run `cucumber` And the exit status should be 1 diff --git a/features/02_configure_aruba/working_directory.feature b/features/02_configure_aruba/working_directory.feature index 8ea9204b7..23edbcdb3 100644 --- a/features/02_configure_aruba/working_directory.feature +++ b/features/02_configure_aruba/working_directory.feature @@ -27,7 +27,12 @@ Feature: Configure working directory of aruba config.working_directory = 'tmp/cucumber' end """ - And the default feature-test - And the default executable + And a file named "features/run.feature" with: + """ + Feature: Run it + Scenario: Fast command + When I run `echo "Hello"` + Then the exit status should be 0 + """ When I successfully run `cucumber` Then a directory named "tmp/cucumber" should exist diff --git a/features/step_definitions/aruba_dev_steps.rb b/features/step_definitions/aruba_dev_steps.rb deleted file mode 100644 index 2e40c820d..000000000 --- a/features/step_definitions/aruba_dev_steps.rb +++ /dev/null @@ -1,24 +0,0 @@ -Given(/^the default executable$/) do - step 'an executable named "bin/aruba-test-cli" with:', <<-EOS -#!/usr/bin/env ruby - -$LOAD_PATH << File.expand_path('../../lib', __FILE__) -require 'cli/app' - -exit 0 - EOS -end - -Given(/^the default feature-test$/) do - step( - 'a file named "features/default.feature" with:', - <<-EOS.strip_heredoc - Feature: Default Feature - - This is the default feature - - Scenario: Run command - Given I successfully run `aruba-test-cli` - EOS - ) -end From 5a7716878f977427f37d8348940c9c672660d872 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 08:30:14 +0100 Subject: [PATCH 05/25] Remove development instruction features These instructions should not be part of the test suite but go in CONTRIBUTING.md instead. --- .../bootstrap-aruba.feature | 21 -------- .../build-aruba.feature | 12 ----- .../build-docker-image.feature | 27 ---------- .../install-gem.feature | 18 ------- .../lint-ruby-sources.feature | 12 ----- .../lint-travis-configuration.feature | 13 ----- .../lint-used-licenses-of-rubygems.feature | 13 ----- .../release-gem.feature | 13 ----- .../run-aruba-console.feature | 13 ----- .../run-docker-container.feature | 25 ---------- .../run-test-suite.feature | 50 ------------------- 11 files changed, 217 deletions(-) delete mode 100644 features/07_development_of_aruba/bootstrap-aruba.feature delete mode 100644 features/07_development_of_aruba/build-aruba.feature delete mode 100644 features/07_development_of_aruba/build-docker-image.feature delete mode 100644 features/07_development_of_aruba/install-gem.feature delete mode 100644 features/07_development_of_aruba/lint-ruby-sources.feature delete mode 100644 features/07_development_of_aruba/lint-travis-configuration.feature delete mode 100644 features/07_development_of_aruba/lint-used-licenses-of-rubygems.feature delete mode 100644 features/07_development_of_aruba/release-gem.feature delete mode 100644 features/07_development_of_aruba/run-aruba-console.feature delete mode 100644 features/07_development_of_aruba/run-docker-container.feature delete mode 100644 features/07_development_of_aruba/run-test-suite.feature diff --git a/features/07_development_of_aruba/bootstrap-aruba.feature b/features/07_development_of_aruba/bootstrap-aruba.feature deleted file mode 100644 index 3ea19848e..000000000 --- a/features/07_development_of_aruba/bootstrap-aruba.feature +++ /dev/null @@ -1,21 +0,0 @@ -Feature: Bootstrap "aruba" - - As a aruba contributor - I want to bootstrap the `aruba` project - In order to start working on it - - Scenario: Run the bootstrap script - - When I successfully run `bin/bootstrap` - Then the output should contain: - """ - [INFO] Checking if ruby installed? OK - """ - And the output should contain: - """ - [INFO] rubygem "bundler" - """ - And the output should contain: - """ - [INFO] "bundle install" - """ diff --git a/features/07_development_of_aruba/build-aruba.feature b/features/07_development_of_aruba/build-aruba.feature deleted file mode 100644 index 941810953..000000000 --- a/features/07_development_of_aruba/build-aruba.feature +++ /dev/null @@ -1,12 +0,0 @@ -Feature: Build Aruba Gem - - As a aruba developer - I want to build the `aruba` gem - In order to install it - - Scenario: Building aruba using rake task - - To build the `aruba`-gem you can use the `gem:build`-rake task. - - Given I successfully run `rake rubygem:build` - Then the output should match %r diff --git a/features/07_development_of_aruba/build-docker-image.feature b/features/07_development_of_aruba/build-docker-image.feature deleted file mode 100644 index e3d2c8be1..000000000 --- a/features/07_development_of_aruba/build-docker-image.feature +++ /dev/null @@ -1,27 +0,0 @@ -Feature: Build docker image - - As a aruba developer - I want to build the docker image for the `aruba` gem - In order to check my changed code - - Scenario: Build the image - - The build can be parameterized by using: - - \* Disable cache - - ``` - rake 'docker:build[false]' - ``` - - \* Build image with version tag - - ``` - rake 'docker:build[false, 0.1.0]' - ``` - - When I successfully run `rake -T docker:build` - Then the output should contain: - """ - rake docker:build - """ diff --git a/features/07_development_of_aruba/install-gem.feature b/features/07_development_of_aruba/install-gem.feature deleted file mode 100644 index 3a5e198c4..000000000 --- a/features/07_development_of_aruba/install-gem.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Install gem - - As a aruba contributor - I want to build the `aruba` gem - In order to install it - - Scenario: Install gem locally - - When I successfully run `rake -T gem:install` - Then the output should contain: - """ - rake rubygem:install - """ - And the output should contain: - """ - rake rubygem:install:local - """ - diff --git a/features/07_development_of_aruba/lint-ruby-sources.feature b/features/07_development_of_aruba/lint-ruby-sources.feature deleted file mode 100644 index 48ec95263..000000000 --- a/features/07_development_of_aruba/lint-ruby-sources.feature +++ /dev/null @@ -1,12 +0,0 @@ -Feature: Lint Ruby sources - - As a aruba contributor - I want to lint the modified ruby sources - In order to be compliant to the code guidelines - - Scenario: Existing rake task - When I successfully run `rake -T lint:coding_guidelines` - Then the output should contain: - """ - rake lint:coding_guidelines - """ diff --git a/features/07_development_of_aruba/lint-travis-configuration.feature b/features/07_development_of_aruba/lint-travis-configuration.feature deleted file mode 100644 index 4a5e700e6..000000000 --- a/features/07_development_of_aruba/lint-travis-configuration.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Lint travis configuration - - As a aruba developer - I want to build the `aruba` gem - In order to install it - - Scenario: Valid travis configuration file - - When I successfully run `rake -T lint:travis` - Then the output should contain: - """ - lint:travis - """ diff --git a/features/07_development_of_aruba/lint-used-licenses-of-rubygems.feature b/features/07_development_of_aruba/lint-used-licenses-of-rubygems.feature deleted file mode 100644 index 88513a8e0..000000000 --- a/features/07_development_of_aruba/lint-used-licenses-of-rubygems.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Make sure only accepted licenses are used by dependencies - - As a aruba developer - I want to build the `aruba` gem - In order to install it - - Scenario: Only accepted licenses are used by dependencies - - When I successfully run `rake -T lint:licenses` - Then the output should contain: - """ - rake lint:licenses - """ diff --git a/features/07_development_of_aruba/release-gem.feature b/features/07_development_of_aruba/release-gem.feature deleted file mode 100644 index 949001a19..000000000 --- a/features/07_development_of_aruba/release-gem.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Release gem - - As a aruba developer - I want to build the `aruba` gem - In order to install it - - Scenario: Release gem - - When I successfully run `rake -T gem:release` - Then the output should contain: - """ - rake rubygem:release - """ diff --git a/features/07_development_of_aruba/run-aruba-console.feature b/features/07_development_of_aruba/run-aruba-console.feature deleted file mode 100644 index 0e3e5f191..000000000 --- a/features/07_development_of_aruba/run-aruba-console.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Running the interactive "aruba" developer console - - As a contributor of aruba - I want to use the interactive aruba console - In order to try out the "aruba" api - - Scenario: Running aruba interactively - - This starts an IRB console with "aruba"'s api loaded. - - When I run `bin/console` interactively - And I type "exit" - Then the exit status should be 0 diff --git a/features/07_development_of_aruba/run-docker-container.feature b/features/07_development_of_aruba/run-docker-container.feature deleted file mode 100644 index 406d0cd45..000000000 --- a/features/07_development_of_aruba/run-docker-container.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: Run a docker container - - As a aruba developer - I want to build the docker image for the `aruba` gem - In order to check my changed code - - Scenario: Run the container with default options - - You can run a specific command within the container: - - ~~~ - rake 'docker:run[cmd]' - ~~~ - - Or just use the default one - - ~~~ - rake 'docker:run' - ~~~ - - When I successfully run `rake -T docker:run` - Then the output should contain: - """ - rake docker:run - """ diff --git a/features/07_development_of_aruba/run-test-suite.feature b/features/07_development_of_aruba/run-test-suite.feature deleted file mode 100644 index 7df73509a..000000000 --- a/features/07_development_of_aruba/run-test-suite.feature +++ /dev/null @@ -1,50 +0,0 @@ -Feature: Run test suite - - As a aruba developer - I want to run the test suite of the `aruba` gem - In order to check my changed code - - Scenario: Run unit tests with `rspec` - - When I successfully run `rake -T test:rspec` - Then the output should contain: - """ - rake test:rspec - """ - - Scenario: Run acceptance tests with `cucumber` - - This task is for fully implemented features. - - When I successfully run `rake -T test:cucumber` - Then the output should contain: - """ - rake test:cucumber - """ - - Scenario: Run acceptance tests with `cucumber` for features which are under active development - - This task is for running tests for features which are Work in Progress and therefore might fail the suite. - - When I successfully run `rake -T test:cucumber_wip` - Then the output should contain: - """ - rake test:cucumber - """ - - Scenario: Run whole test suite via rake - - When I successfully run `rake -T test` - Then the output should contain: - """ - rake test - """ - - @ignore - Scenario: Run whole test suite via "test"-script - - When I successfully run `bin/test` - Then the output should contain: - """ - rake test - """ From c5f6f4f0704e510c92547d55be13d5233613dade Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 09:40:20 +0100 Subject: [PATCH 06/25] Improve contribution guidelines - Fix some typos and wording issues. - Add developer instructions that were in the feature files before. --- CONTRIBUTING.md | 169 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 127 insertions(+), 42 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f5a1dd96..ca95946f1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,20 +18,33 @@ We would love to get help from you as "user" and "contributor". * Add missing documentation * Improve our test coverage -The rest of this document is a guide for those maintaining Aruba, and others who would like to submit patches. +The rest of this document is a guide for those maintaining Aruba, and others +who would like to submit patches. ## Contributing to the "aruba" project -It would be great if all people who want to contribute to the "aruba" project – contributors and maintiners – follow the guidelines in this section. There are also "Getting started"-sections both for [contributors](#getting-started-as-a-contributor) and [maintainers]((#getting-started-as-a-maintainer). +It would be great if all people who want to contribute to the "aruba" project +— contributors and maintainers — follow the guidelines in this +section. There are also "Getting started"-sections both for +[contributors](#getting-started-as-a-contributor) and +[maintainers](#getting-started-as-a-maintainer). ### Issues -We appreciate that. But before you do, please learn our basic rules: +About to create a new Github Issue? We appreciate that. But before you do, +please learn our basic rules: -* This is not a support forum. If you have a question, please go to [The Cukes Google Group](http://groups.google.com/group/cukes). -* Do you have an idea for a new feature? Then don't expect it to be implemented unless you or someone else sends a [pull request](https://help.github.com/articles/using-pull-requests). You might be better to start a discussion on [the google group](http://groups.google.com/group/cukes). +* This is not a support forum. If you have a question, please go to + [The Cukes Google Group](http://groups.google.com/group/cukes). +* Do you have an idea for a new feature? Then don't expect it to be implemented + unless you or someone else sends a + [pull request](https://help.github.com/articles/using-pull-requests). It + might be better to start a discussion on + [the google group](http://groups.google.com/group/cukes). * Reporting a bug? Just follow our comments in the issue template -* We love [pull requests](https://help.github.com/articles/using-pull-requests). The same here: Please consider our comments within the template we provide for your pull request(s). +* We love [pull requests](https://help.github.com/articles/using-pull-requests). + The same here: Please consider our comments within the template we provide + for your pull request(s). ### Pull Requests @@ -41,32 +54,47 @@ We appreciate that. But before you do, please learn our basic rules: Please... * Fork the project. Make a branch for your change. -* Make your feature addition or bug fix – if you're unsure if your addition will be accepted, open an issue for discussion first -* Make sure your patch is well covered by tests. We don't accept changes that aren't tested. +* Make your feature addition or bug fix — if you're unsure if your + addition will be accepted, open an issue for discussion first +* Make sure your patch is well covered by tests. We don't accept changes that + aren't tested. * Please do not change the Rakefile, version, or history. - (if you want to have your own version, that is fine but - bump version in a commit by itself so we can ignore when we merge your change) -* Make sure your pull request complies to our development style -* Rebase your branch if needed to reduce clutter in our git history -* Make sure you don't break other people's code – On major changes: First deprecated, than bump major version, than make breaking changes -* Split up your changes into reviewable "git"-commits which combine all lines/files relevant for a single change + (If you want to have your own version, that is fine but + bump version in a commit by itself so we can ignore it when we merge your change.) +* Make sure your pull request complies with our development style. +* Rebase your branch if needed to reduce clutter in our git history. +* Make sure you don't break other people's code — On major changes: First + deprecate, then bump major version, then make breaking changes, +* Split up your changes into reviewable "git"-commits which combine all + lines/files relevant for a single change. * Send us a pull request. **Maintainers** -* Use pull requests for larger or controversial changes made by yourself or changes you might expected to break the build -* Commit smaller changes directly to master, e.g. fixing typos, adding tests or adding documentation -* Update [History.md](History.md) when a pull request is merged -* Make sure all tests are green before merging a pull request +* Use pull requests for larger or controversial changes made by yourself or + changes you might expected to break the build. +* Commit smaller changes directly to master, e.g. fixing typos, adding tests or + adding documentation. +* Update [CHANGELOG.md](CHANGELOG.md) when a pull request is merged. +* Make sure all tests are green before merging a pull request. ### Development style -* We try to follow the recommendations in the [Ruby Community Style Guide](https://github.com/bbatsov/ruby-style-guide) and use [`rubocop`](https://github.com/bbatsov/rubocop) to "enforce" it. Please see [.rubocop.yml](.rubocop.yml) for exceptions. -* There should be `action`-methods and `getter`-methods in `aruba`. Only the latter should return values. Please expect the first ones to return `nil`. -* Add documentation (aka acceptance tests) for new features using `aruba`'s steps and place them some where suitable in [here](features/). -* Add unit tests where needed to cover edge cases which are not (directly) relevant for users -* Add developer documentation in [`yardoc`](http://yardoc.org/) to all relevant methods added -* Format your commits messages following those seven rules -- see [this blog post](http://chris.beams.io/posts/git-commit/) for a well written explanation about the why. +* We try to follow the recommendations in the + [Ruby Community Style Guide](https://github.com/bbatsov/ruby-style-guide) and use + [`rubocop`](https://github.com/bbatsov/rubocop) to "enforce" it. Please see + [.rubocop.yml](.rubocop.yml) for exceptions. +* There should be `action`-methods and `getter`-methods in `aruba`. Only the + latter should return values. Please expect the first ones to return `nil`. +* Add documentation (aka acceptance tests) for new features using `aruba`'s + steps and place them some where suitable in [here](features/). +* Add unit tests where needed to cover edge cases which are not (directly) + relevant for users. +* Add developer documentation in [`yardoc`](http://yardoc.org/) to all relevant + methods added. +* Format your commits messages following those seven rules — see + [this blog post](http://chris.beams.io/posts/git-commit/) for a well written + explanation about the why. 1. Separate subject from body with a blank line 2. Limit the subject line to 50 characters 3. Capitalize the subject line @@ -74,8 +102,6 @@ Please... 5. Use the imperative mood in the subject line 6. Wrap the body at 72 characters 7. Use the body to explain what and why vs. how (optional if subject is self-explanatory) - 8. Use Markdown Markup to style your message (only if required) - ## Getting started as a "Contributor" @@ -94,27 +120,44 @@ bin/bootstrap Make sure you bootstrap the environment first. Then run the following command to run the test suite. -~~~bash +```bash # Run the test suite bin/test -~~~ -If you have problems because our assumptions about your local setup are wrong. -Try this instead. This requires the `docker`-command/project to be installed on +# Or use these rake tasks: + +# Run the whole test suite +rake test +# Run RSpec tests +rake test:rspec +# Run Cucumber features +rake test:cucumber +# Run Cucumber features which are "WORK IN PROGRESS" and are allowed to fail +rake test:cucumber_wip +``` + +If you have problems because our assumptions about your local setup are wrong, +try the follwing instead. This requires the `docker`-command/project to be installed on your local system. -~~~bash +```bash # Build the docker container bundle exec rake docker:build +# Build with disabled cache +bundle exec rake 'docker:build[false]' + +# Build image with version tag +bundle exec rake 'docker:build[false, 0.1.0]' + # Run the whole test suite in "docker"-container RUN_IN_DOCKER=1 bin/test # Run only selected scenario RUN_IN_DOCKER=1 bin/test cucumber features/steps/command/shell.feature:14 -~~~ +``` -## Installing your own gems used for development +### Installing your own gems used for development A `Gemfile.local`-file can be used to have your own gems installed to support your normal development workflow. @@ -127,14 +170,51 @@ gem 'pry-byebug' gem 'byebug' ~~~ +### Running a developer console + +If you want to try out the Aruba api, you canuse the interactive aruba console: + +```bash +bin/console +``` + +This will start an IRB console with Aruba's API loaded. + +### Linting + +Aruba's Rakefile provides the following linting tasks + +```bash +bundle exec rake lint # Run all linters +bundle exec rake lint:coding_guidelines # Lint our code with "rubocop" +bundle exec rake lint:licenses # Check for relevant licenses in project +bundle exec rake lint:travis # Lint our .travis.yml +``` + +### Building and installing your local Aruba version + +You can use the following rake tasks to build and install your work-in-progress locally: + +```bash +# Build your copy +bundle exec rake rubygem:build +# Build and install your copy +bundle exec rake rubygem:install +# Build and install your copy without network access +bundle exec rake rubygem:install:local +``` + ## Getting started as a "Maintainer" ### Release Process * Bump the version number in `lib/aruba/version.rb` -* Make sure `History.md` is updated with the upcoming version number, and has entries for all fixes. -* No need to add a `History.md` header at this point - this should be done when a new change is made, later. -* If a major version is released, update the `still`-branch which points to "old" major version +* Make sure `CHANGELOG.md` is updated with the upcoming version number, and has + entries for all fixes. +* No need to add a `CHANGELOG.md` header at this point - this should be done + when a new change is made, later. +* If a major version is released, update the `still`-branch which points to + "old" major version Now release it @@ -156,17 +236,22 @@ git merge master git push ~~~ -Now send a PR to https://github.com/cucumber/website adding an article about the with details of the new release and merge it - an aruba maintainer should normally allowed to merge PRs on `cucumber/website`. A copy of an old announcement can be used as basis for the new article. After this send an email with the link to the article to cukes@googlegroups.com. +Now send a PR to https://github.com/cucumber/website adding an article +with details of the new release and merge it - an aruba maintainer should +normally allowed to merge PRs on `cucumber/website`. A copy of an old +announcement can be used as basis for the new article. After this send an email +with the link to the article to cukes@googlegroups.com. ### Gaining Release Karma -To become a release manager, create a pull request adding your name to the list below, and include your Rubygems email address in the ticket. One of the existing Release managers will then add you. +To become a release manager, create a pull request adding your name to the list +below, and include your Rubygems email address in the ticket. One of the +existing Release managers will then add you. Current release managers: - * Aslak Hellesøy ([@aslakhellesoy](http://github.com/aslakhellesoy)) - * Dennis Günnewig ([@maxmeyer](http://github.com/maxmeyer), [@dg-rationdata](http://github.com/dg-rationdata)) - * Jarl Friis ([@jarl-dk](https://github.com/jarl-dk)) - * Matt Wynne ([@mattwynne](http://github.com/mattwynne)) + * Aslak Hellesøy ([@aslakhellesoy](https://github.com/aslakhellesoy)) + * Matt Wynne ([@mattwynne](https://github.com/mattwynne)) + * Matijs van Zuijlen ([@mvz](https://github.com/mvz)) To grant release karma, issue the following command: From acf2bef5742425d14486fd2785851d28c0feae72 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 10:51:39 +0100 Subject: [PATCH 07/25] Lower waiting time in send_signal_to_command.feature --- .../command/send_signal_to_command.feature | 49 ++++++------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/send_signal_to_command.feature b/features/03_testing_frameworks/cucumber/steps/command/send_signal_to_command.feature index a17f23216..f239d1930 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/send_signal_to_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/send_signal_to_command.feature @@ -9,9 +9,7 @@ Feature: Send a signal to command Background: Given I use a fixture named "cli-app" - - Scenario: Sending signal to the command started last - Given an executable named "bin/aruba-test-cli" with: + And an executable named "bin/aruba-test-cli" with: """bash #!/usr/bin/env bash function hup { @@ -20,14 +18,21 @@ Feature: Send a signal to command } trap hup HUP - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done + """ + And a file named "features/support/aruba_config.rb" with: + """ruby + Aruba.configure do |config| + config.startup_wait_time = 0.1 + config.exit_timeout = 0.2 + end """ - And a file named "features/run.feature" with: + + Scenario: Sending signal to the command started last + Given a file named "features/run.feature" with: """ Feature: Run it Scenario: Run command - Given the default aruba exit timeout is 5 seconds - And I wait 5 seconds for a command to start up When I run `aruba-test-cli` in background And I send the signal "HUP" to the command started last Then the exit status should be 0 @@ -40,23 +45,10 @@ Feature: Send a signal to command Then the features should all pass Scenario: Sending signal to a command given by command line - Given an executable named "bin/aruba-test-cli" with: - """bash - #!/usr/bin/env bash - function hup { - echo "Got signal HUP." - exit 0 - } - - trap hup HUP - while [ true ]; do sleep 1; done - """ - And a file named "features/run.feature" with: + Given a file named "features/run.feature" with: """ Feature: Run it Scenario: Run command - Given the default aruba exit timeout is 5 seconds - And I wait 5 seconds for a command to start up When I run `aruba-test-cli` in background And I send the signal "HUP" to the command "aruba-test-cli" Then the exit status should be 0 @@ -76,23 +68,10 @@ Feature: Send a signal to command PID of the last command started. Please note, this feature is experimental. The name of the variable may change without further notice. - Given an executable named "bin/aruba-test-cli" with: - """bash - #!/usr/bin/env bash - function hup { - echo "Got signal HUP." - exit 0 - } - - trap hup HUP - while [ true ]; do sleep 1; done - """ - And a file named "features/run.feature" with: + Given a file named "features/run.feature" with: """ Feature: Run it Scenario: Run command - Given the default aruba exit timeout is 5 seconds - And I wait 5 seconds for a command to start up When I run `aruba-test-cli` in background And I run `kill -HUP ` Then the output should contain: From 4ccddce6f60fcca30dba716c68ced526de443950 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 11:55:56 +0100 Subject: [PATCH 08/25] Lower waiting time in check_for_exit_statuses.feature --- .../steps/command/check_for_exit_statuses.feature | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature b/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature index 4ead78755..0887c784a 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature @@ -89,13 +89,13 @@ Feature: Check exit status of commands Given an executable named "bin/aruba-test-cli" with: """ #!/bin/bash - sleep 1 + sleep 0.1 """ And a file named "features/exit_status.feature" with: """ Feature: Failing program Scenario: Run command - Given the default aruba exit timeout is 2 seconds + Given the default aruba exit timeout is 1 second When I successfully run `aruba-test-cli` """ When I run `cucumber` @@ -105,7 +105,7 @@ Feature: Check exit status of commands Given an executable named "bin/aruba-test-cli" with: """ #!/bin/bash - sleep 1 + sleep 0.1 """ And a file named "features/exit_status.feature" with: """ @@ -121,14 +121,14 @@ Feature: Check exit status of commands Given an executable named "bin/aruba-test-cli" with: """ #!/bin/bash - sleep 2 + sleep 0.1 """ And a file named "features/exit_status.feature" with: """ Feature: Failing program Scenario: Run command Given the default aruba exit timeout is 0 seconds - When I successfully run `aruba-test-cli` for up to 1 seconds + When I successfully run `aruba-test-cli` """ When I run `cucumber` Then the features should not all pass with: From 42edf0130a65b921ebea89c391a88b837bbb3e7d Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 14:12:10 +0100 Subject: [PATCH 09/25] Move specs for Aruba::Api::Command to their proper location --- spec/aruba/api/commands_spec.rb | 31 +++++++++++++++++++++++++++++++ spec/aruba/api_spec.rb | 24 ------------------------ 2 files changed, 31 insertions(+), 24 deletions(-) create mode 100644 spec/aruba/api/commands_spec.rb diff --git a/spec/aruba/api/commands_spec.rb b/spec/aruba/api/commands_spec.rb new file mode 100644 index 000000000..cdf56f4dc --- /dev/null +++ b/spec/aruba/api/commands_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' +require 'aruba/api' +require 'fileutils' + +RSpec.describe Aruba::Api::Commands do + include_context 'uses aruba API' + + describe '#run_command' do + before(:each) { @aruba.run_command 'cat' } + after(:each) { @aruba.all_commands.each(&:stop) } + + it "respond to input" do + @aruba.type "Hello" + @aruba.type "" + expect(@aruba.last_command_started).to have_output "Hello" + end + + it "respond to close_input" do + @aruba.type "Hello" + @aruba.close_input + expect(@aruba.last_command_started).to have_output "Hello" + end + + it "pipes data" do + @aruba.write_file(@file_name, "Hello\nWorld!") + @aruba.pipe_in_file(@file_name) + @aruba.close_input + expect(@aruba.last_command_started).to have_output "Hello\nWorld!" + end + end +end diff --git a/spec/aruba/api_spec.rb b/spec/aruba/api_spec.rb index 0e9773275..432d0065f 100644 --- a/spec/aruba/api_spec.rb +++ b/spec/aruba/api_spec.rb @@ -35,30 +35,6 @@ end end - describe '#run_command' do - before(:each) { @aruba.run_command 'cat' } - after(:each) { @aruba.all_commands.each(&:stop) } - - it "respond to input" do - @aruba.type "Hello" - @aruba.type "" - expect(@aruba.last_command_started).to have_output "Hello" - end - - it "respond to close_input" do - @aruba.type "Hello" - @aruba.close_input - expect(@aruba.last_command_started).to have_output "Hello" - end - - it "pipes data" do - @aruba.write_file(@file_name, "Hello\nWorld!") - @aruba.pipe_in_file(@file_name) - @aruba.close_input - expect(@aruba.last_command_started).to have_output "Hello\nWorld!" - end - end - describe 'fixtures' do let(:api) do klass = Class.new do From baa6cfacb2c878512f5452c9a0346dff64839610 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 15:16:57 +0100 Subject: [PATCH 10/25] Refuse to launch interactively with the :in_process launcher --- .../command/run_command_in_process.feature | 8 +- lib/aruba/api/commands.rb | 103 ++++++++++-------- lib/aruba/processes/basic_process.rb | 3 +- lib/aruba/processes/debug_process.rb | 4 + lib/aruba/processes/in_process.rb | 4 + lib/aruba/processes/spawn_process.rb | 4 + spec/aruba/api/commands_spec.rb | 48 +++++--- 7 files changed, 112 insertions(+), 62 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/run_command_in_process.feature b/features/03_testing_frameworks/cucumber/steps/command/run_command_in_process.feature index 51dd6ac40..3fbfb82d0 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/run_command_in_process.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/run_command_in_process.feature @@ -349,7 +349,7 @@ Feature: Run commands in ruby process type some letters on keyboard - can only appear later, but this point is never reached, because ruby is blocked. - Given the default aruba exit timeout is 5 seconds + Given the default aruba exit timeout is 3 seconds And a file named "lib/cli/app/runner.rb" with: """ module Cli @@ -374,7 +374,7 @@ Feature: Run commands in ruby process Feature: Run a command in process @in-process Scenario: Run command - Given the default aruba exit timeout is 2 seconds + Given the default aruba exit timeout is 1 seconds When I run `reverse.rb do_it` interactively When I type "hello" Then the output should contain: @@ -384,3 +384,7 @@ Feature: Run commands in ruby process """ When I run `cucumber` Then the exit status should not be 0 + And the output should contain: + """ + Running interactively is not supported with this process launcher + """ diff --git a/lib/aruba/api/commands.rb b/lib/aruba/api/commands.rb index 2d6e98d83..2bac7a09f 100644 --- a/lib/aruba/api/commands.rb +++ b/lib/aruba/api/commands.rb @@ -123,54 +123,18 @@ def find_command(commandline) # @yield [SpawnProcess] # Run block with process # - # rubocop:disable Metrics/MethodLength - # rubocop:disable Metrics/CyclomaticComplexity def run_command(cmd, opts = {}) - exit_timeout = opts[:exit_timeout].nil? ? aruba.config.exit_timeout : opts[:exit_timeout] - io_wait_timeout = opts[:io_wait_timeout].nil? ? aruba.config.io_wait_timeout : opts[:io_wait_timeout] - stop_signal = opts[:stop_signal].nil? ? aruba.config.stop_signal : opts[:stop_signal] - startup_wait_time = opts[:startup_wait_time].nil? ? aruba.config.startup_wait_time : opts[:startup_wait_time] + command = prepare_command(cmd, opts) - cmd = replace_variables(cmd) - - @commands ||= [] - @commands << cmd - - environment = aruba.environment - working_directory = expand_path('.') - event_bus = aruba.event_bus - - cmd = Aruba.platform.detect_ruby(cmd) - - mode = aruba.config.command_launcher - - main_class = aruba.config.main_class - - command = Command.new( - cmd, - mode: mode, - exit_timeout: exit_timeout, - io_wait_timeout: io_wait_timeout, - working_directory: working_directory, - environment: environment.to_hash, - main_class: main_class, - stop_signal: stop_signal, - startup_wait_time: startup_wait_time, - event_bus: event_bus - ) - - aruba.config.before(:command, self, command) - - command.start - - aruba.announcer.announce(:stop_signal, command.pid, stop_signal) if stop_signal + unless command.interactive? + raise NotImplementedError, + "Running interactively is not supported with this process launcher." + end - aruba.config.after(:command, self, command) + start_command(command) block_given? ? yield(command) : command end - # rubocop:enable Metrics/CyclomaticComplexity - # rubocop:enable Metrics/MethodLength # Run a command with aruba # @@ -199,7 +163,8 @@ def run_command_and_stop(cmd, opts = {}) true end - command = run_command(cmd, opts) + command = prepare_command(cmd, opts) + start_command(command) command.stop return unless fail_on_error @@ -227,6 +192,58 @@ def type(input) def close_input last_command_started.close_io(:stdin) end + + private + + # rubocop:disable Metrics/MethodLength + # rubocop:disable Metrics/CyclomaticComplexity + def prepare_command(cmd, opts) + exit_timeout = opts[:exit_timeout].nil? ? aruba.config.exit_timeout : opts[:exit_timeout] + io_wait_timeout = opts[:io_wait_timeout].nil? ? aruba.config.io_wait_timeout : opts[:io_wait_timeout] + stop_signal = opts[:stop_signal].nil? ? aruba.config.stop_signal : opts[:stop_signal] + startup_wait_time = opts[:startup_wait_time].nil? ? aruba.config.startup_wait_time : opts[:startup_wait_time] + + cmd = replace_variables(cmd) + + @commands ||= [] + @commands << cmd + + environment = aruba.environment + working_directory = expand_path('.') + event_bus = aruba.event_bus + + cmd = Aruba.platform.detect_ruby(cmd) + + mode = aruba.config.command_launcher + + main_class = aruba.config.main_class + + Command.new( + cmd, + mode: mode, + exit_timeout: exit_timeout, + io_wait_timeout: io_wait_timeout, + working_directory: working_directory, + environment: environment.to_hash, + main_class: main_class, + stop_signal: stop_signal, + startup_wait_time: startup_wait_time, + event_bus: event_bus + ) + end + # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/MethodLength + + def start_command(command) + aruba.config.before(:command, self, command) + + command.start + + stop_signal = command.stop_signal + aruba.announcer.announce(:stop_signal, command.pid, stop_signal) if stop_signal + + aruba.config.after(:command, self, command) + end end end end diff --git a/lib/aruba/processes/basic_process.rb b/lib/aruba/processes/basic_process.rb index 46a240abb..93970a333 100644 --- a/lib/aruba/processes/basic_process.rb +++ b/lib/aruba/processes/basic_process.rb @@ -11,7 +11,8 @@ module Processes # # @private class BasicProcess - attr_reader :exit_status, :environment, :working_directory, :main_class, :io_wait_timeout, :exit_timeout, :startup_wait_time + attr_reader :exit_status, :environment, :working_directory, :main_class, + :io_wait_timeout, :exit_timeout, :startup_wait_time, :stop_signal def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, environment = ENV.to_hash.dup, main_class = nil, stop_signal = nil, startup_wait_time = 0) @cmd = cmd diff --git a/lib/aruba/processes/debug_process.rb b/lib/aruba/processes/debug_process.rb index c546fc089..1bb4ef9dd 100644 --- a/lib/aruba/processes/debug_process.rb +++ b/lib/aruba/processes/debug_process.rb @@ -65,6 +65,10 @@ def stop(*) def terminate(*) stop end + + def interactive? + true + end end end end diff --git a/lib/aruba/processes/in_process.rb b/lib/aruba/processes/in_process.rb index bcfb13a6c..4c578ccb5 100644 --- a/lib/aruba/processes/in_process.rb +++ b/lib/aruba/processes/in_process.rb @@ -117,6 +117,10 @@ def terminate def pid $PROCESS_ID end + + def interactive? + false + end end end end diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb index 5e7eec075..c655bcaf7 100644 --- a/lib/aruba/processes/spawn_process.rb +++ b/lib/aruba/processes/spawn_process.rb @@ -249,6 +249,10 @@ def content File.read command_string.to_s end + def interactive? + true + end + private def command_string diff --git a/spec/aruba/api/commands_spec.rb b/spec/aruba/api/commands_spec.rb index cdf56f4dc..e05d24c64 100644 --- a/spec/aruba/api/commands_spec.rb +++ b/spec/aruba/api/commands_spec.rb @@ -6,26 +6,42 @@ include_context 'uses aruba API' describe '#run_command' do - before(:each) { @aruba.run_command 'cat' } - after(:each) { @aruba.all_commands.each(&:stop) } + context 'when succesfully running a command' do + before(:each) { @aruba.run_command 'cat' } + after(:each) { @aruba.all_commands.each(&:stop) } - it "respond to input" do - @aruba.type "Hello" - @aruba.type "" - expect(@aruba.last_command_started).to have_output "Hello" - end + it "respond to input" do + @aruba.type "Hello" + @aruba.type "" + expect(@aruba.last_command_started).to have_output "Hello" + end + + it "respond to close_input" do + @aruba.type "Hello" + @aruba.close_input + expect(@aruba.last_command_started).to have_output "Hello" + end - it "respond to close_input" do - @aruba.type "Hello" - @aruba.close_input - expect(@aruba.last_command_started).to have_output "Hello" + it "pipes data" do + @aruba.write_file(@file_name, "Hello\nWorld!") + @aruba.pipe_in_file(@file_name) + @aruba.close_input + expect(@aruba.last_command_started).to have_output "Hello\nWorld!" + end end - it "pipes data" do - @aruba.write_file(@file_name, "Hello\nWorld!") - @aruba.pipe_in_file(@file_name) - @aruba.close_input - expect(@aruba.last_command_started).to have_output "Hello\nWorld!" + context 'when mode is :in_process' do + before do + @aruba.aruba.config.command_launcher = :in_process + end + + after do + @aruba.aruba.config.command_launcher = :spawn + end + + it 'raises an error' do + expect { @aruba.run_command 'cat' }.to raise_error NotImplementedError + end end end end From f21d4fa152e3ae19f98eaa91bf45c747aa7d579c Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 23:39:07 +0100 Subject: [PATCH 11/25] Lower waiting time in stop_command.feature --- .../steps/command/stop_command.feature | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature index ecc961a9c..714b13996 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature @@ -25,7 +25,7 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 1 """ And an executable named "bin/aruba-test-cli2" with: @@ -38,7 +38,7 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 1 """ And a file named "features/stop.feature" with: @@ -46,7 +46,7 @@ Feature: Stop commands Feature: Run it Scenario: Run command Given the default aruba exit timeout is 1 second - And I wait 2 seconds for a command to start up + And I wait 1 second for a command to start up When I run `aruba-test-cli1` in background And I run `aruba-test-cli2` in background And I terminate the command started last @@ -75,7 +75,7 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 1 """ And an executable named "bin/aruba-test-cli2" with: @@ -88,7 +88,7 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 1 """ And a file named "features/stop.feature" with: @@ -97,8 +97,8 @@ Feature: Stop commands Background: Scenario: Run command - Given the default aruba exit timeout is 5 seconds - And I wait 2 seconds for a command to start up + Given the default aruba exit timeout is 1 second + And I wait 1 second for a command to start up When I run `aruba-test-cli1` in background And I run `aruba-test-cli2` in background And I stop the command started last @@ -126,7 +126,7 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done """ And an executable named "bin/aruba-test-cli2" with: """bash @@ -138,17 +138,17 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 2 """ And a file named "features/stop.feature" with: """ Feature: Run it Background: - Given the default aruba exit timeout is 5 seconds + Given the default aruba exit timeout is 1 second Scenario: Run command - Given I wait 2 seconds for a command to start up + Given I wait 1 second for a command to start up When I run `aruba-test-cli1` in background When I run `aruba-test-cli2` in background And I terminate the command "aruba-test-cli1" @@ -177,7 +177,7 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 1 """ And an executable named "bin/aruba-test-cli2" with: @@ -190,17 +190,17 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 1 """ And a file named "features/stop.feature" with: """ Feature: Run it Background: - Given the default aruba exit timeout is 5 seconds + Given the default aruba exit timeout is 1 second Scenario: Run command - Given I wait 2 seconds for a command to start up + Given I wait 1 second for a command to start up When I run `aruba-test-cli1` in background And I run `aruba-test-cli2` in background When I stop the command "aruba-test-cli1" @@ -231,7 +231,7 @@ Feature: Stop commands trap hup HUP trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 1 """ And a file named "features/run.feature" with: @@ -239,8 +239,9 @@ Feature: Stop commands Feature: Run it Scenario: Run command Given the default aruba stop signal is "HUP" - And the default aruba exit timeout is 5 seconds + And the default aruba exit timeout is 1 second When I run `aruba-test-cli` + And I terminate the command started last Then the exit status should be 155 """ When I run `cucumber` @@ -259,7 +260,7 @@ Feature: Stop commands trap term TERM echo "Hello, Aruba!" - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done exit 1 """ And a file named "features/stop.feature" with: @@ -267,7 +268,7 @@ Feature: Stop commands Feature: Run it Scenario: Run command Given the default aruba exit timeout is 1 second - And I wait 2 seconds for a command to start up + And I wait 1 second for a command to start up When I run `aruba-test-cli1` in background And I terminate the command started last Then the exit status should be 100 From e7c133103cf054ba5f569f153e419a95406f6a3e Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 23:55:17 +0100 Subject: [PATCH 12/25] Remove trailing whitespace --- .../cucumber/steps/command/check_output_of_command.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature b/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature index d73178de4..d00bbc361 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature @@ -453,7 +453,7 @@ Feature: All output of commands which were executed """bash #!/usr/bin/env bash - for ((c=0; c<256; c = c+1)); do + for ((c=0; c<256; c = c+1)); do echo -n "a" done """ From 7748c89bf400184056103e87fd55f621569c2b6e Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 2 Mar 2018 23:55:26 +0100 Subject: [PATCH 13/25] Remove superfluous check The cucumber regexp will already ensure channel has a valid value. --- lib/aruba/cucumber/command.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/aruba/cucumber/command.rb b/lib/aruba/cucumber/command.rb index 10e89670a..2e838190c 100644 --- a/lib/aruba/cucumber/command.rb +++ b/lib/aruba/cucumber/command.rb @@ -63,8 +63,6 @@ end When(/^I stop the command(?: started last)? if (output|stdout|stderr) contains:$/) do |channel, expected| - fail %(Invalid output channel "#{channel}" chosen. Please choose one of "output, stdout or stderr") unless %w(output stdout stderr).include? channel - begin Timeout.timeout(aruba.config.exit_timeout) do loop do From 434f6435b5ab9c6b949e10ad99bd2009802b1bb0 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 08:39:11 +0100 Subject: [PATCH 14/25] Lower waiting time in run_command.feature --- .../04_aruba_api/command/run_command.feature | 117 +++++++++++------- 1 file changed, 73 insertions(+), 44 deletions(-) diff --git a/features/04_aruba_api/command/run_command.feature b/features/04_aruba_api/command/run_command.feature index 00f4dc9d3..1e47b972a 100644 --- a/features/04_aruba_api/command/run_command.feature +++ b/features/04_aruba_api/command/run_command.feature @@ -33,7 +33,7 @@ Feature: Run command """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('aruba-test-cli') } it { expect(last_command_started).to be_successfully_executed } end @@ -51,7 +51,7 @@ Feature: Run command """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('bin/aruba-test-cli') } it { expect(last_command_started).to be_successfully_executed } end @@ -65,7 +65,7 @@ Feature: Run command """ruby require 'spec_helper' - RSpec.describe 'Find path for command', :type => :aruba do + RSpec.describe 'Find path for command', type: :aruba do it { expect { run_command('aruba-test-cli') }.to raise_error Aruba::LaunchError, /Command "aruba-test-cli" not found in PATH-variable/ } end """ @@ -84,7 +84,7 @@ Feature: Run command #!/usr/bin/env bash function initialize_script { - sleep 2 + sleep 0.2 } function do_some_work { @@ -105,20 +105,25 @@ Feature: Run command initialize_script do_some_work - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 2 do - before(:each) { run_command('aruba-test-cli') } - before(:each) { last_command_started.send_signal 'HUP' } - - it { expect(last_command_started).to be_successfully_executed } - it { expect(last_command_started).to have_output /Hello, Aruba is working/ } - it { expect(last_command_started).to have_output /Hello, Aruba here/ } - + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.1, startup_wait_time: 0.2 do + before do + run_command('aruba-test-cli') + last_command_started.send_signal 'HUP' + end + + it 'runs the command with the expected results' do + aggregate_failures do + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_output /Hello, Aruba is working/ + expect(last_command_started).to have_output /Hello, Aruba here/ + end + end end """ When I run `rspec` @@ -134,7 +139,7 @@ Feature: Run command #!/usr/bin/env bash function do_some_work { - sleep 2 + sleep 0.2 echo "Hello, Aruba here" } @@ -144,11 +149,15 @@ Feature: Run command """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3 do - before(:each) { run_command('aruba-test-cli') } + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.3 do + before { run_command('aruba-test-cli') } - it { expect(last_command_started).to be_successfully_executed } - it { expect(last_command_started).to have_output /Hello, Aruba here/ } + it 'runs the command with the expected results' do + aggregate_failures do + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_output /Hello, Aruba here/ + end + end end """ When I run `rspec` @@ -164,15 +173,15 @@ Feature: Run command #!/usr/bin/env bash function initialize_script { - sleep 2 + sleep 0.2 } function do_some_work { - echo "Hello, Aruba is working" + echo "Hello, Aruba 1 is working" } function recurring_work { - echo "Hello, Aruba here" + echo "Hello, Aruba 1 here" } function stop_script { @@ -185,7 +194,7 @@ Feature: Run command initialize_script do_some_work - while [ true ]; do sleep 0.2; done + while [ true ]; do sleep 0.1; done """ And an executable named "bin/aruba-test-cli2" with: """bash @@ -196,11 +205,11 @@ Feature: Run command } function do_some_work { - echo "Hello, Aruba is working" + echo "Hello, Aruba 2 is working" } function recurring_work { - echo "Hello, Aruba here" + echo "Hello, Aruba 2 here" } function stop_script { @@ -213,21 +222,31 @@ Feature: Run command initialize_script do_some_work - while [ true ]; do sleep 0.2; done + while [ true ]; do sleep 0.1; done """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1 do - before(:each) { run_command('aruba-test-cli1', :startup_wait_time => 2) } - before(:each) { run_command('aruba-test-cli2', :startup_wait_time => 1) } - before(:each) { last_command_started.send_signal 'HUP' } - - it { expect(last_command_started).to be_successfully_executed } - it { expect(last_command_started).to have_output /Hello, Aruba is working/ } - it { expect(last_command_started).to have_output /Hello, Aruba here/ } - + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.1 do + before do + run_command 'aruba-test-cli1', startup_wait_time: 0.3 + run_command 'aruba-test-cli2', startup_wait_time: 0.1 + last_command_started.send_signal 'HUP' + end + + it 'runs both commands with the expected results' do + cli1 = find_command('aruba-test-cli1') + cli2 = find_command('aruba-test-cli2') + aggregate_failures do + expect(cli1).to be_successfully_executed + expect(cli1).to have_output /Hello, Aruba 1 is working/ + expect(cli1).not_to have_output /Hello, Aruba 1 here/ + expect(cli2).to be_successfully_executed + expect(cli2).to have_output /Hello, Aruba 2 is working/ + expect(cli2).to have_output /Hello, Aruba 2 here/ + end + end end """ When I run `rspec` @@ -243,8 +262,8 @@ Feature: Run command #!/usr/bin/env bash function do_some_work { - sleep 2 - echo "Hello, Aruba here" + sleep 0.2 + echo "Hello, Aruba 1 here" } do_some_work @@ -254,7 +273,7 @@ Feature: Run command #!/usr/bin/env bash function do_some_work { - echo "Hello, Aruba here" + echo "Hello, Aruba 2 here" } do_some_work @@ -263,12 +282,22 @@ Feature: Run command """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do - before(:each) { run_command('aruba-test-cli1', :exit_timeout => 3) } - before(:each) { run_command('aruba-test-cli2', :exit_timeout => 1) } - - it { expect(last_command_started).to be_successfully_executed } - it { expect(last_command_started).to have_output /Hello, Aruba here/ } + RSpec.describe 'Run command', type: :aruba do + before do + run_command 'aruba-test-cli1', exit_timeout: 0.3 + run_command 'aruba-test-cli2', exit_timeout: 0.1 + end + + it 'runs both commands with the expected results' do + cli1 = find_command('aruba-test-cli1') + cli2 = find_command('aruba-test-cli2') + aggregate_failures do + expect(cli1).to be_successfully_executed + expect(cli1).to have_output /Hello, Aruba 1 here/ + expect(cli2).to be_successfully_executed + expect(cli2).to have_output /Hello, Aruba 2 here/ + end + end end """ When I run `rspec` @@ -284,7 +313,7 @@ Feature: Run command """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('aruba-test-cli') } let!(:found_command) { find_command('aruba-test-cli') } it { expect { found_command.start }.to raise_error Aruba::CommandAlreadyStartedError } From e4f1dd4185b9dff9a15b560cfe1d028518f47d3e Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 08:48:45 +0100 Subject: [PATCH 15/25] Lower waiting time in stop_single_command.feature --- .../command/stop_single_command.feature | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/features/04_aruba_api/command/stop_single_command.feature b/features/04_aruba_api/command/stop_single_command.feature index d1dd91cb2..b6b9a24a1 100644 --- a/features/04_aruba_api/command/stop_single_command.feature +++ b/features/04_aruba_api/command/stop_single_command.feature @@ -6,7 +6,7 @@ Feature: Stop command - `find_command('command').stop` But normally there's no need to stop a command manually. All matchers - handling commands make sure, that they stop ALL command before check actual + handling commands make sure, that they stop ALL commands before checking actual against expected. Background: @@ -21,13 +21,13 @@ Feature: Stop command } trap term TERM - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.2 do before(:each) { run_command('aruba-test-cli') } before(:each) { last_command_started.stop } it { expect(last_command_started).to be_successfully_executed } @@ -45,13 +45,14 @@ Feature: Stop command } trap term TERM - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done + exit 1 """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.2 do before(:each) { run_command('aruba-test-cli') } before(:each) { find_command('aruba-test-cli').stop } it { expect(last_command_started).to be_successfully_executed } @@ -76,7 +77,7 @@ Feature: Stop command trap hup HUP trap term TERM - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done """ And a file named "spec/run_spec.rb" with: """ruby @@ -84,10 +85,10 @@ Feature: Stop command Aruba.configure do |config| config.stop_signal = 'HUP' - config.exit_timeout = 1 + config.exit_timeout = 0.2 end - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('aruba-test-cli') } it { expect(last_command_started).to be_successfully_executed } end @@ -111,7 +112,7 @@ Feature: Stop command trap hup HUP trap term TERM - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done """ And a file named "spec/run_spec.rb" with: """ruby @@ -119,10 +120,10 @@ Feature: Stop command Aruba.configure do |config| config.stop_signal = 'HUP' - config.exit_timeout = 1 + config.exit_timeout = 0.2 end - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('aruba-test-cli') } it { expect(last_command_started).to have_exit_status 2 } end From c93187dfd583ddecb256278e29fbf69ecd6610fe Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 08:52:37 +0100 Subject: [PATCH 16/25] Lower waiting time in terminate_all_commands.feature --- .../command/terminate_all_commands.feature | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/features/04_aruba_api/command/terminate_all_commands.feature b/features/04_aruba_api/command/terminate_all_commands.feature index 5c901ee75..d01e300b5 100644 --- a/features/04_aruba_api/command/terminate_all_commands.feature +++ b/features/04_aruba_api/command/terminate_all_commands.feature @@ -15,7 +15,7 @@ Feature: Terminate all commands """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 5 do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 5 do before(:each) { run_command('aruba-test-cli') } before(:each) { run_command('aruba-test-cli') } @@ -31,22 +31,26 @@ Feature: Terminate all commands Given an executable named "bin/aruba-test-cli" with: """bash #!/bin/bash - sleep 1 + sleep 0.5 """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2 do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 1 do before(:each) { @cmd1 = run_command('aruba-test-cli') } before(:each) { @cmd2 = run_command('aruba-test-cli') } before(:each) { @cmd3 = run_command('sleep 1') } before(:each) { terminate_all_commands { |c| c.commandline == 'aruba-test-cli' } } - it { expect(@cmd1).to be_stopped } - it { expect(@cmd2).to be_stopped } - it { expect(@cmd3).not_to be_stopped } + it 'only terminates selected commands' do + aggregate_failures do + expect(@cmd1).to be_stopped + expect(@cmd2).to be_stopped + expect(@cmd3).not_to be_stopped + end + end end """ When I run `rspec` From 1e7c13b4157a03e5b2bf8260d76d7d026f417553 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 08:57:08 +0100 Subject: [PATCH 17/25] Lower waiting time in use_last_command_stopped.feature --- .../command/use_last_command_stopped.feature | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/features/04_aruba_api/command/use_last_command_stopped.feature b/features/04_aruba_api/command/use_last_command_stopped.feature index 0fe27e208..4103572de 100644 --- a/features/04_aruba_api/command/use_last_command_stopped.feature +++ b/features/04_aruba_api/command/use_last_command_stopped.feature @@ -8,7 +8,7 @@ Feature: Return last command stopped """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('echo hello') } before(:each) { stop_all_commands } @@ -24,7 +24,7 @@ Feature: Return last command stopped """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('echo hello') } before(:each) { run_command('echo world') } @@ -42,7 +42,7 @@ Feature: Return last command stopped """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('echo hello') } before(:each) { find_command('echo hello').stop } before(:each) { run_command('echo world') } @@ -60,7 +60,7 @@ Feature: Return last command stopped """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do it { expect{ last_command_stopped.commandline }.to raise_error Aruba::NoCommandHasBeenStoppedError } end """ @@ -71,13 +71,13 @@ Feature: Return last command stopped Given an executable named "bin/aruba-test-cli" with: """bash #!/bin/bash - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.2 do before(:each) { run_command('aruba-test-cli') } it { expect{ last_command_stopped.commandline }.to raise_error Aruba::NoCommandHasBeenStoppedError } From cc33a7f9762ff3a1bdbc1c7091861ec53fd73714 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 09:17:44 +0100 Subject: [PATCH 18/25] Correctly use non-integer io_wait_timeout values --- .../command/read_stderr_of_command.feature | 10 +++++----- .../command/read_stdout_of_command.feature | 10 +++++----- lib/aruba/processes/spawn_process.rb | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/features/04_aruba_api/command/read_stderr_of_command.feature b/features/04_aruba_api/command/read_stderr_of_command.feature index be1f01f32..ef5ad227e 100644 --- a/features/04_aruba_api/command/read_stderr_of_command.feature +++ b/features/04_aruba_api/command/read_stderr_of_command.feature @@ -5,7 +5,7 @@ Feature: Access STDERR of command Background: Given I use a fixture named "cli-app" - And the default aruba io wait timeout is 1 seconds + And the default aruba io wait timeout is 0 seconds Scenario: Existing executable Given an executable named "bin/aruba-test-cli" with: @@ -17,7 +17,7 @@ Feature: Access STDERR of command """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('aruba-test-cli') } before(:each) { stop_all_commands } it { expect(last_command_started.stderr).to start_with 'Hello' } @@ -26,18 +26,18 @@ Feature: Access STDERR of command When I run `rspec` Then the specs should all pass - Scenario: Waiting for output to "appear" after 2 seconds + Scenario: Waiting for output to appear Given an executable named "bin/aruba-test-cli" with: """bash #!/bin/bash - sleep 1 + sleep 0.1 echo 'Hello, Aruba' >&2 """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :io_wait_timeout => 2 do + RSpec.describe 'Run command', type: :aruba, io_wait_timeout: 0.2 do before(:each) { run_command('aruba-test-cli') } it { expect(last_command_started.stderr).to start_with 'Hello' } end diff --git a/features/04_aruba_api/command/read_stdout_of_command.feature b/features/04_aruba_api/command/read_stdout_of_command.feature index 2e3fe2215..0ba83df8f 100644 --- a/features/04_aruba_api/command/read_stdout_of_command.feature +++ b/features/04_aruba_api/command/read_stdout_of_command.feature @@ -5,7 +5,7 @@ Feature: Access STDOUT of command Background: Given I use a fixture named "cli-app" - And the default aruba io wait timeout is 1 seconds + And the default aruba io wait timeout is 0 seconds Scenario: Existing executable Given an executable named "bin/aruba-test-cli" with: @@ -17,7 +17,7 @@ Feature: Access STDOUT of command """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do before(:each) { run_command('aruba-test-cli') } before(:each) { stop_all_commands } it { expect(last_command_started.stdout).to start_with 'Hello' } @@ -26,18 +26,18 @@ Feature: Access STDOUT of command When I run `rspec` Then the specs should all pass - Scenario: Waiting for output to "appear" after 2 seconds + Scenario: Waiting for output to appear Given an executable named "bin/aruba-test-cli" with: """bash #!/bin/bash - sleep 1 + sleep 0.1 echo 'Hello, Aruba' """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :io_wait_timeout => 2 do + RSpec.describe 'Run command', type: :aruba, io_wait_timeout: 0.2 do before(:each) { run_command('aruba-test-cli') } it { expect(last_command_started.stdout).to start_with 'Hello' } end diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb index c655bcaf7..f35ae54aa 100644 --- a/lib/aruba/processes/spawn_process.rb +++ b/lib/aruba/processes/spawn_process.rb @@ -265,7 +265,7 @@ def command_string end def wait_for_io(time_to_wait) - sleep time_to_wait.to_i + sleep time_to_wait yield end From 11cdb70d6785f5ea8c2f26fa577b8be18d7e7a25 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 09:22:48 +0100 Subject: [PATCH 19/25] Fix documentation of numeric parameters --- lib/aruba/api/commands.rb | 10 +++++----- lib/aruba/processes/spawn_process.rb | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/aruba/api/commands.rb b/lib/aruba/api/commands.rb index 2bac7a09f..25eda77d5 100644 --- a/lib/aruba/api/commands.rb +++ b/lib/aruba/api/commands.rb @@ -108,13 +108,13 @@ def find_command(commandline) # @param [Hash] opts # Options # - # @option opts [Integer] exit_timeout + # @option opts [Numeric] exit_timeout # If the timeout is reached the command will be killed # - # @option opts [Integer] io_wait_timeout + # @option opts [Numeric] io_wait_timeout # Wait for IO to finish # - # @option opts [Integer] startup_wait_time + # @option opts [Numeric] startup_wait_time # Wait for a command to start # # @option opts [String] stop_signal @@ -150,10 +150,10 @@ def run_command(cmd, opts = {}) # @option options [Boolean] fail_on_error # Should aruba fail on error? # - # @option options [Integer] exit_timeout + # @option options [Numeric] exit_timeout # Timeout for execution # - # @option options [Integer] io_wait_timeout + # @option options [Numeric] io_wait_timeout # Timeout for IO - STDERR, STDOUT # def run_command_and_stop(cmd, opts = {}) diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb index f35ae54aa..4e4a48b2a 100644 --- a/lib/aruba/processes/spawn_process.rb +++ b/lib/aruba/processes/spawn_process.rb @@ -28,10 +28,10 @@ def self.match?(_mode) # @param [String] cmd # Command string # - # @param [Integer] exit_timeout + # @param [Numeric] exit_timeout # The timeout until we expect the command to be finished # - # @param [Integer] io_wait_timeout + # @param [Numeric] io_wait_timeout # The timeout until we expect the io to be finished # # @param [String] working_directory @@ -46,7 +46,7 @@ def self.match?(_mode) # @param [String] stop_signal # Name of signal to send to stop process. E.g. 'HUP'. # - # @param [Integer] startup_wait_time + # @param [Numeric] startup_wait_time # The amount of seconds to wait after Aruba has started a command. def initialize(cmd, exit_timeout, io_wait_timeout, working_directory, environment = ENV.to_hash.dup, main_class = nil, stop_signal = nil, startup_wait_time = 0) super From ee7c4ed2546fcfbd11c6f3187d48a1995b48a3d0 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 09:35:01 +0100 Subject: [PATCH 20/25] Lower waiting time in run_simple.feature --- .../04_aruba_api/command/run_simple.feature | 58 +++++++++++-------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/features/04_aruba_api/command/run_simple.feature b/features/04_aruba_api/command/run_simple.feature index b2c774022..45f155689 100644 --- a/features/04_aruba_api/command/run_simple.feature +++ b/features/04_aruba_api/command/run_simple.feature @@ -22,7 +22,7 @@ Feature: Run command in a simpler fashion """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do + RSpec.describe 'Run command', type: :aruba do it { expect { run_command_and_stop('aruba-test-cli') }.to raise_error RSpec::Expectations::ExpectationNotMetError } end """ @@ -39,8 +39,8 @@ Feature: Run command in a simpler fashion """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do - it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => true) }.to raise_error } + RSpec.describe 'Run command', type: :aruba do + it { expect { run_command_and_stop('aruba-test-cli', fail_on_error: true) }.to raise_error } end """ When I run `rspec` @@ -56,8 +56,8 @@ Feature: Run command in a simpler fashion """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba do - it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => false) }.not_to raise_error } + RSpec.describe 'Run command', type: :aruba do + it { expect { run_command_and_stop('aruba-test-cli', fail_on_error: false) }.not_to raise_error } end """ When I run `rspec` @@ -68,14 +68,14 @@ Feature: Run command in a simpler fashion If you have got a command with a long startup phase or use `ruby` together with `bundler`, you should consider using the `startup_wait_time`-option. Otherwise methods like `#send_signal` don't work since they require the - command to be running and have setup it's signal handler. + command to be running and have setup its signal handler. Given an executable named "bin/aruba-test-cli" with: """bash #!/usr/bin/env bash function initialize_script { - sleep 2 + sleep 0.2 } function do_some_work { @@ -91,19 +91,23 @@ Feature: Run command in a simpler fashion """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 2 do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.1, startup_wait_time: 0.3 do before(:each) { run_command_and_stop('aruba-test-cli') } - it { expect(last_command_started).to be_successfully_executed } - it { expect(last_command_started).to have_output /Hello, Aruba is working/ } + it 'runs the command with the expected results' do + aggregate_failures do + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_output /Hello, Aruba is working/ + end + end end """ When I run `rspec` Then the specs should all pass - Scenario: Long running command + Scenario: Long-running command - If you have got a "long running" command, you should consider using the + If you have got a long-running command, you should consider using the `exit_timeout`-option. Given an executable named "bin/aruba-test-cli" with: @@ -111,7 +115,7 @@ Feature: Run command in a simpler fashion #!/usr/bin/env bash function do_some_work { - sleep 2 + sleep 0.2 echo "Hello, Aruba here" } @@ -121,11 +125,15 @@ Feature: Run command in a simpler fashion """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3 do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.3 do before(:each) { run_command_and_stop('aruba-test-cli') } - it { expect(last_command_started).to be_successfully_executed } - it { expect(last_command_started).to have_output /Hello, Aruba here/ } + it 'runs the command with the expected results' do + aggregate_failures do + expect(last_command_started).to be_successfully_executed + expect(last_command_started).to have_output /Hello, Aruba here/ + end + end end """ When I run `rspec` @@ -142,11 +150,11 @@ Feature: Run command in a simpler fashion #!/usr/bin/env bash function initialize_script { - sleep 1 + sleep 0.1 } function cleanup_script { - sleep 1 + sleep 0.1 } function do_some_work { @@ -164,9 +172,13 @@ Feature: Run command in a simpler fashion """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2, :startup_wait_time => 1 do - before(:each) { run_command_and_stop('aruba-test-cli') } - it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError } + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.2, startup_wait_time: 0.2 do + before { run_command_and_stop('aruba-test-cli') } + + it 'refuses to send a signal' do + expect { last_command_started.send_signal 'HUP' }. + to raise_error Aruba::CommandAlreadyStoppedError + end end """ When I run `rspec` @@ -189,8 +201,8 @@ Feature: Run command in a simpler fashion config.activate_announcer_on_command_failure = [:stdout, :stderr] end - RSpec.describe 'Run command', :type => :aruba do - it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => true) }.to_not raise_error } + RSpec.describe 'Run command', type: :aruba do + it { expect { run_command_and_stop('aruba-test-cli', fail_on_error: true) }.to_not raise_error } end """ When I run `rspec` From 66d7bf61e05697fc075f6e3c5bd89c4af88eaa7b Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 09:37:30 +0100 Subject: [PATCH 21/25] Lower waiting time in send_signal_to_command.feature --- .../04_aruba_api/command/send_signal_to_command.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/04_aruba_api/command/send_signal_to_command.feature b/features/04_aruba_api/command/send_signal_to_command.feature index 67d35d381..fee82e008 100644 --- a/features/04_aruba_api/command/send_signal_to_command.feature +++ b/features/04_aruba_api/command/send_signal_to_command.feature @@ -19,13 +19,13 @@ Feature: Send running command a signal trap hup HUP - while [ true ]; do sleep 1; done + while [ true ]; do sleep 0.1; done """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 5 do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 1, startup_wait_time: 0.1 do before(:each) { run_command('aruba-test-cli') } before(:each) { last_command_started.send_signal 'HUP' } it { expect(last_command_started).to have_output /Exit/ } @@ -44,7 +44,7 @@ Feature: Send running command a signal """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 5 do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 1, startup_wait_time: 0.1 do before(:each) { run_command('aruba-test-cli') } it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError, /Command "aruba-test-cli" with PID/ } end From 28b4dc5b6a20c30b7f272260e632f077482c8b3f Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sat, 3 Mar 2018 10:07:54 +0100 Subject: [PATCH 22/25] Lower waiting time in stop_all_commands.feature --- .../command/stop_all_commands.feature | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/features/04_aruba_api/command/stop_all_commands.feature b/features/04_aruba_api/command/stop_all_commands.feature index 719b128a0..1b3f49375 100644 --- a/features/04_aruba_api/command/stop_all_commands.feature +++ b/features/04_aruba_api/command/stop_all_commands.feature @@ -9,13 +9,13 @@ Feature: Stop all commands Given an executable named "bin/aruba-test-cli" with: """bash #!/bin/bash - sleep 3 + sleep 0.2 """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 5 do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.3 do before(:each) { run_command('aruba-test-cli') } before(:each) { run_command('aruba-test-cli') } @@ -31,22 +31,26 @@ Feature: Stop all commands Given an executable named "bin/aruba-test-cli" with: """bash #!/bin/bash - sleep 1 + sleep 0.1 """ And a file named "spec/run_spec.rb" with: """ruby require 'spec_helper' - RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2 do + RSpec.describe 'Run command', type: :aruba, exit_timeout: 0.2 do before(:each) { @cmd1 = run_command('aruba-test-cli') } before(:each) { @cmd2 = run_command('aruba-test-cli') } before(:each) { @cmd3 = run_command('sleep 1') } before(:each) { stop_all_commands { |c| c.commandline == 'aruba-test-cli' } } - it { expect(@cmd1).to be_stopped } - it { expect(@cmd2).to be_stopped } - it { expect(@cmd3).not_to be_stopped } + it 'only stops selected commands' do + aggregate_failures do + expect(@cmd1).to be_stopped + expect(@cmd2).to be_stopped + expect(@cmd3).not_to be_stopped + end + end end """ When I run `rspec` From b81e865fc6d9653440428bdac28bb58cb8f109a7 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Tue, 6 Mar 2018 20:07:48 +0100 Subject: [PATCH 23/25] Allow decimal values for seconds values --- .../command/check_for_exit_statuses.feature | 4 ++-- .../steps/command/stop_command.feature | 22 +++++++++---------- .../command/read_stderr_of_command.feature | 2 +- lib/aruba/cucumber/command.rb | 16 +++++++------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature b/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature index 0887c784a..105005421 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature @@ -95,7 +95,7 @@ Feature: Check exit status of commands """ Feature: Failing program Scenario: Run command - Given the default aruba exit timeout is 1 second + Given the default aruba exit timeout is 0.2 seconds When I successfully run `aruba-test-cli` """ When I run `cucumber` @@ -112,7 +112,7 @@ Feature: Check exit status of commands Feature: Failing program Scenario: Run command Given the default aruba exit timeout is 0 seconds - When I successfully run `aruba-test-cli` for up to 2 seconds + When I successfully run `aruba-test-cli` for up to 0.2 seconds """ When I run `cucumber` Then the features should all pass diff --git a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature index 714b13996..546955e14 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature @@ -45,8 +45,8 @@ Feature: Stop commands """ Feature: Run it Scenario: Run command - Given the default aruba exit timeout is 1 second - And I wait 1 second for a command to start up + Given the default aruba exit timeout is 0.2 seconds + And I wait 0.1 seconds for a command to start up When I run `aruba-test-cli1` in background And I run `aruba-test-cli2` in background And I terminate the command started last @@ -97,8 +97,8 @@ Feature: Stop commands Background: Scenario: Run command - Given the default aruba exit timeout is 1 second - And I wait 1 second for a command to start up + Given the default aruba exit timeout is 0.2 seconds + And I wait 0.1 seconds for a command to start up When I run `aruba-test-cli1` in background And I run `aruba-test-cli2` in background And I stop the command started last @@ -145,10 +145,10 @@ Feature: Stop commands """ Feature: Run it Background: - Given the default aruba exit timeout is 1 second + Given the default aruba exit timeout is 0.2 seconds Scenario: Run command - Given I wait 1 second for a command to start up + Given I wait 0.1 seconds for a command to start up When I run `aruba-test-cli1` in background When I run `aruba-test-cli2` in background And I terminate the command "aruba-test-cli1" @@ -197,10 +197,10 @@ Feature: Stop commands """ Feature: Run it Background: - Given the default aruba exit timeout is 1 second + Given the default aruba exit timeout is 0.2 seconds Scenario: Run command - Given I wait 1 second for a command to start up + Given I wait 0.1 seconds for a command to start up When I run `aruba-test-cli1` in background And I run `aruba-test-cli2` in background When I stop the command "aruba-test-cli1" @@ -239,7 +239,7 @@ Feature: Stop commands Feature: Run it Scenario: Run command Given the default aruba stop signal is "HUP" - And the default aruba exit timeout is 1 second + And the default aruba exit timeout is 0.2 seconds When I run `aruba-test-cli` And I terminate the command started last Then the exit status should be 155 @@ -267,8 +267,8 @@ Feature: Stop commands """ Feature: Run it Scenario: Run command - Given the default aruba exit timeout is 1 second - And I wait 1 second for a command to start up + Given the default aruba exit timeout is 0.2 seconds + And I wait 0.1 seconds for a command to start up When I run `aruba-test-cli1` in background And I terminate the command started last Then the exit status should be 100 diff --git a/features/04_aruba_api/command/read_stderr_of_command.feature b/features/04_aruba_api/command/read_stderr_of_command.feature index ef5ad227e..7f746dbba 100644 --- a/features/04_aruba_api/command/read_stderr_of_command.feature +++ b/features/04_aruba_api/command/read_stderr_of_command.feature @@ -5,7 +5,7 @@ Feature: Access STDERR of command Background: Given I use a fixture named "cli-app" - And the default aruba io wait timeout is 0 seconds + And the default aruba io wait timeout is 0.1 seconds Scenario: Existing executable Given an executable named "bin/aruba-test-cli" with: diff --git a/lib/aruba/cucumber/command.rb b/lib/aruba/cucumber/command.rb index 2e838190c..1ff03d099 100644 --- a/lib/aruba/cucumber/command.rb +++ b/lib/aruba/cucumber/command.rb @@ -7,9 +7,9 @@ ## I successfully run `echo -n "Hello"` ## I successfully run `sleep 29` for up to 30 seconds -When(/^I successfully run `(.*?)`(?: for up to (\d+) seconds)?$/) do |cmd, secs| +When(/^I successfully run `(.*?)`(?: for up to ([\d.]+) seconds)?$/) do |cmd, secs| cmd = sanitize_text(cmd) - run_command_and_stop(cmd, fail_on_error: true, exit_timeout: secs && secs.to_i) + run_command_and_stop(cmd, fail_on_error: true, exit_timeout: secs && secs.to_f) end When(/^I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:$/) do |shell, commands| @@ -323,20 +323,20 @@ end end -Given(/^the (?:default )?aruba io wait timeout is (\d+) seconds?$/) do |seconds| - aruba.config.io_wait_timeout = seconds.to_i +Given(/^the (?:default )?aruba io wait timeout is ([\d.]+) seconds?$/) do |seconds| + aruba.config.io_wait_timeout = seconds.to_f end -Given(/^the (?:default )?aruba exit timeout is (\d+) seconds?$/) do |seconds| - aruba.config.exit_timeout = seconds.to_i +Given(/^the (?:default )?aruba exit timeout is ([\d.]+) seconds?$/) do |seconds| + aruba.config.exit_timeout = seconds.to_f end Given(/^the (?:default )?aruba stop signal is "([^"]*)"$/) do |signal| aruba.config.stop_signal = signal end -Given(/^I wait (\d+) seconds? for (?:a|the) command to start up$/) do |seconds| - aruba.config.startup_wait_time = seconds.to_i +Given(/^I wait ([\d.]+) seconds? for (?:a|the) command to start up$/) do |seconds| + aruba.config.startup_wait_time = seconds.to_f end When(/^I send the signal "([^"]*)" to the command (?:"([^"]*)"|(?:started last))$/) do |signal, command| From 1869e80508bee7476702aa4e14518196857a680a Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Wed, 7 Mar 2018 07:29:12 +0100 Subject: [PATCH 24/25] Allow more time for javac to run --- features/01_getting_started_with_aruba/run_commands.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/01_getting_started_with_aruba/run_commands.feature b/features/01_getting_started_with_aruba/run_commands.feature index ca730d544..86c20a763 100644 --- a/features/01_getting_started_with_aruba/run_commands.feature +++ b/features/01_getting_started_with_aruba/run_commands.feature @@ -160,7 +160,7 @@ Feature: Run commands with Aruba } } \"\"\" - And I successfully run `javac tmp/HelloArubaApp.java` + And I successfully run `javac tmp/HelloArubaApp.java` for up to 20 seconds And I cd to "tmp/" And I successfully run `java HelloArubaApp` Then the output should contain: @@ -168,7 +168,7 @@ Feature: Run commands with Aruba Hello, Aruba! \"\"\" """ - When I successfully run `cucumber` + When I successfully run `cucumber` for up to 21 seconds Then the features should all pass @requires-posix-standard-tools From d8aafed7e30b4f7852f91175a229c6f40ebcb58a Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Wed, 7 Mar 2018 08:26:48 +0100 Subject: [PATCH 25/25] Clean up feature background The background section contained a step that was only relevant to some of the scenarios. Distribute it where relevant instead. --- .../run_commands.feature | 48 +++++++++++++++---- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/features/01_getting_started_with_aruba/run_commands.feature b/features/01_getting_started_with_aruba/run_commands.feature index 86c20a763..bbed97733 100644 --- a/features/01_getting_started_with_aruba/run_commands.feature +++ b/features/01_getting_started_with_aruba/run_commands.feature @@ -12,6 +12,15 @@ Feature: Run commands with Aruba Background: Given I use a fixture named "getting-started-app" + + @requires-bash + Scenario: Bash Program + Given an executable named "bin/aruba-test-cli" with: + """bash + #!/usr/bin/env bash + + echo "Hello, Aruba!" + """ And a file named "features/hello_aruba.feature" with: """ Feature: Getting Started With Aruba @@ -22,15 +31,6 @@ Feature: Run commands with Aruba Hello, Aruba! \"\"\" """ - - @requires-bash - Scenario: Bash Program - Given an executable named "bin/aruba-test-cli" with: - """bash - #!/usr/bin/env bash - - echo "Hello, Aruba!" - """ When I successfully run `cucumber` Then the features should all pass @@ -61,6 +61,16 @@ Feature: Run commands with Aruba puts "Hello, Aruba!" """ + And a file named "features/hello_aruba.feature" with: + """ + Feature: Getting Started With Aruba + Scenario: First Run of Command + Given I successfully run `aruba-test-cli` + Then the output should contain: + \"\"\" + Hello, Aruba! + \"\"\" + """ When I successfully run `cucumber` Then the features should all pass @@ -91,6 +101,16 @@ Feature: Run commands with Aruba print("Hello, Aruba!") """ + And a file named "features/hello_aruba.feature" with: + """ + Feature: Getting Started With Aruba + Scenario: First Run of Command + Given I successfully run `aruba-test-cli` + Then the output should contain: + \"\"\" + Hello, Aruba! + \"\"\" + """ When I successfully run `cucumber` Then the features should all pass @@ -121,6 +141,16 @@ Feature: Run commands with Aruba print "Hello, Aruba!\n"; """ + And a file named "features/hello_aruba.feature" with: + """ + Feature: Getting Started With Aruba + Scenario: First Run of Command + Given I successfully run `aruba-test-cli` + Then the output should contain: + \"\"\" + Hello, Aruba! + \"\"\" + """ When I successfully run `cucumber` Then the features should all pass