Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve appveyor build - Cucumber part #619

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
09deb34
Run cucumber scenarios on Windows
mvz Apr 5, 2021
8609a39
Temporarily limit set of platforms
mvz Jun 18, 2021
8546717
Add bat runner for default test cli app
mvz Jun 30, 2019
8bb5d11
Use default executable instead of specifying another
mvz Jun 30, 2019
4143497
CI: Skip scenarios with `@requires-bash` unless bash is installed.
xtrasimplicity Jun 10, 2018
b4dc9e1
Improve be_a_command_found_in_path matcher and its tests
mvz Jul 3, 2019
7fed560
Make check_timeouts feature cross-platform
mvz Jul 3, 2019
13e4d96
Silence warnings about ansicon
mvz Apr 5, 2021
727b96c
Started adding unpublished windows-specific features.
xtrasimplicity Jun 10, 2018
5ce5013
CI: Windows - Fixed CleanUpWorkingDirectory feature.
xtrasimplicity Jun 10, 2018
84f5c54
Fixed usage of .cucumberproignore file.
xtrasimplicity Jun 10, 2018
1bc2b7e
CI: Windows - Fixed 01\getting_started\RunCommands feature.
xtrasimplicity Jun 10, 2018
40cfc31
CI: Windows - Fixed supported_testing_frameworks.feature
xtrasimplicity Jun 10, 2018
d1a0b02
Add @requires-sleep hook
xtrasimplicity Jun 10, 2018
850d2b9
CI: Windows - Fixed 02_ConfiguringAruba\CommandRuntimeEnvironment.fea…
xtrasimplicity Jun 10, 2018
9cc8e13
CI: Windows - Skip Exit timeout config. Added ToDo.
xtrasimplicity Jun 10, 2018
490a749
CI: Windows - Fixed 02_Configuring_Aruba\HomeDirectory feature.
xtrasimplicity Jun 10, 2018
dbbb24f
CI: Windows - Fixed 03\testing_frameworks\cucumber\announce_...
xtrasimplicity Jun 10, 2018
cc4e3a6
CI: Windows - Fixed `disabling bundler` feature.
xtrasimplicity Jun 10, 2018
30a1387
CI: Windows - Fix `define_after_hook_for_commands` feature.
xtrasimplicity Jun 10, 2018
7b0aabb
CI: Windows - Fix `define_before_hook_for_commands` feature. (Cucumber)
xtrasimplicity Jun 10, 2018
cccd29b
CI: Windows - Fixed `check_for_exit_status` feature (Cucumber)
xtrasimplicity Jun 10, 2018
48a2c99
Mark Windows-only version of Cleanup Working Directory feature as such
mvz Jun 19, 2021
d3a6cbe
WIP: Disable ...
mvz Jun 19, 2021
08a250a
CI: Windows - Fixed ConfuringAruba\Basics.feature
xtrasimplicity Jun 10, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cucumberproignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/
!features/
features/04_aruba_api/command/run_simple.feature
features/unpublished
15 changes: 8 additions & 7 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ jobs:

strategy:
matrix:
ruby: ["3.1", "3.2", "jruby-9.4", "3.3"]
appraisal: [cucumber_8, cucumber_9]
include:
- ruby: "3.0"
appraisal: cucumber_8
ruby: ["3.2"]
appraisal: [cucumber_9]

env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile
Expand All @@ -48,7 +45,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ["3.2"]

runs-on: macos-latest

Expand All @@ -68,7 +65,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
ruby: ["3.2"]

runs-on: windows-latest

Expand All @@ -81,8 +78,12 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install ansicon to silence colour warnings
run: cinst ansicon
- name: Run specs
run: bundle exec rake spec
- name: Run cukes
run: bundle exec rake cucumber

checks:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Feature: Cleanup Aruba Working Directory
Background:
Given I use a fixture named "cli-app"

@unsupported-on-platform-windows
Scenario: Clean up artifacts and pwd from a previous scenario
Given a file named "features/cleanup.feature" with:
"""
Expand All @@ -30,6 +31,7 @@ Feature: Cleanup Aruba Working Directory
When I run `cucumber`
Then the features should all pass

@unsupported-on-platform-windows
Scenario: Do not clobber before run
The `@no-clobber` tag stops Aruba from clearing out its scratch directory.
Other setup steps are still performed, such as setting the current working
Expand Down
4 changes: 2 additions & 2 deletions features/01_getting_started_with_aruba/run_commands.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Run commands with Aruba
Background:
Given I use a fixture named "getting-started-app"

@requires-bash
@requires-bash @unsupported-on-platform-windows
Scenario: Bash Program
Given an executable named "bin/aruba-test-cli" with:
"""bash
Expand Down Expand Up @@ -48,7 +48,7 @@ Feature: Run commands with Aruba
When I successfully run `cucumber`
Then the features should all pass

@requires-ruby
@requires-ruby @unsupported-on-platform-windows
Scenario: Ruby Program
Given an executable named "bin/aruba-test-cli" with:
"""ruby
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Feature: Supported Testing Frameworks
"""
$LOAD_PATH.unshift File.expand_path('../test', __FILE__)

require 'test_helper'
require_relative 'test_helper'
require 'minitest/autorun'

class FirstRun < Minitest::Test
Expand All @@ -86,3 +86,4 @@ Feature: Supported Testing Frameworks
"""
When I run `ruby -Ilib:test test/use_aruba_with_minitest.rb`
Then the tests should all pass

21 changes: 11 additions & 10 deletions features/02_configure_aruba/basics.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@requires-sleep @todo-improve-cross-platform-support
Feature: Usage of configuration

You can configure `aruba` in two ways:
Expand Down Expand Up @@ -33,12 +34,12 @@ Feature: Usage of configuration
RSpec.describe 'Run command', :type => :aruba do
context 'when fast command' do
before { run_command('aruba-test-cli 0') }
before { run_command('ruby ./aruba-test-cli 0') }
it { expect(last_command_started).to be_successfully_executed }
end
context 'when slow command' do
before { run_command('aruba-test-cli 1') }
before { run_command('ruby ./aruba-test-cli 1') }
it { expect(last_command_started).not_to be_successfully_executed }
end
end
Expand Down Expand Up @@ -74,17 +75,17 @@ Feature: Usage of configuration
RSpec.describe 'Run command', :type => :aruba do
context 'when fast command' do
before { run_command('aruba-test-cli 0') }
before { run_command('ruby ./aruba-test-cli 0') }
it { expect(last_command_started).to be_successfully_executed }
end
context 'when slow command and this is known by the developer', :slow_command => true do
before { run_command('aruba-test-cli 1') }
before { run_command('ruby ./aruba-test-cli 1') }
it { expect(last_command_started).to be_successfully_executed }
end
context 'when slow command, but this might be a failure' do
before { run_command('aruba-test-cli 1') }
before { run_command('ruby ./aruba-test-cli 1') }
it { expect(last_command_started).not_to be_successfully_executed }
end
end
Expand All @@ -103,11 +104,11 @@ Feature: Usage of configuration
"""
Feature: Run it
Scenario: Fast command
When I run `aruba-test-cli 0`
When I run `ruby ./aruba-test-cli 0`
Then the exit status should be 0
Scenario: Slow command
When I run `aruba-test-cli 1.0`
When I run `ruby ./aruba-test-cli 1.0`
Then the exit status should be 128
"""
When I run `cucumber`
Expand Down Expand Up @@ -135,16 +136,16 @@ Feature: Usage of configuration
"""
Feature: Run it
Scenario: Fast command
When I run `aruba-test-cli 0`
When I run `ruby ./aruba-test-cli 0`
Then the exit status should be 0
@slow-command
Scenario: Slow command known by the developer
When I run `aruba-test-cli 0.5`
When I run `ruby ./aruba-test-cli 0.5`
Then the exit status should be 0
Scenario: Slow command which might be a failure
When I run `aruba-test-cli 0.5`
When I run `ruby ./aruba-test-cli 0.5`
Then the exit status should be 128
"""
When I run `cucumber`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@requires-env @unsupported-on-platform-windows
Feature: Define default process environment
Say you want to have a default set of environment variables, then use this
code.
Expand Down
1 change: 1 addition & 0 deletions features/02_configure_aruba/exit_timeout.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@unsupported-on-platform-windows @todo-improve-cross-platform-support
Feature: Configure timeout for command execution

As a developer
Expand Down
4 changes: 2 additions & 2 deletions features/02_configure_aruba/home_directory.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: Configure the home directory to be used with aruba
When I successfully run `cucumber`
Then the output should match:
"""
The default value is "/.*/tmp/aruba"
The default value is ".*/tmp/aruba"
"""

Scenario: Set to current working directory
Expand Down Expand Up @@ -60,7 +60,7 @@ Feature: Configure the home directory to be used with aruba
Then I successfully run `cucumber`
Then the output should match:
"""
The value is "/.*/tmp/aruba/home"
The value is ".*/tmp/aruba/home"
"""

Scenario: Set to some other path (deprecated)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@requires-bash
Feature: Announce output during test run

In order to specify expected output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Feature: After command hooks
Background:
Given I use a fixture named "cli-app"

@requires-cat
Scenario: Run a simple command with an "after(:command)"-hook
Given a file named "features/support/hooks.rb" with:
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@requires-cat
Feature: before_cmd hooks

You can configure Aruba to run blocks of code before it runs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@requires-bash
Feature: Check exit status of commands

Use the `the exit status should be \d`-step to check the exit status of the
Expand All @@ -6,7 +7,7 @@ Feature: Check exit status of commands

Background:
Given I use a fixture named "cli-app"

Scenario: Test for exit status of 0
Given an executable named "bin/aruba-test-cli" with:
"""
Expand Down Expand Up @@ -85,6 +86,7 @@ Feature: Check exit status of commands
When I run `cucumber`
Then the features should not all pass

@requires-sleep
Scenario: Overwrite the default exit timeout via step
Given an executable named "bin/aruba-test-cli" with:
"""
Expand Down
7 changes: 1 addition & 6 deletions features/04_aruba_api/command/run_command.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ Feature: Run command
Given I use a fixture named "cli-app"

Scenario: Executable in the project's path
Given an executable named "bin/aruba-test-cli" with:
"""bash
#!/bin/bash
exit 0
"""
And a file named "spec/run_spec.rb" with:
Given a file named "spec/run_spec.rb" with:
"""ruby
require 'spec_helper'

Expand Down
39 changes: 17 additions & 22 deletions features/05_use_rspec_matchers/command/check_timeouts.feature
Original file line number Diff line number Diff line change
@@ -1,47 +1,42 @@
Feature: Check if a timeout occured during command execution

If you want to check if a command takes to long to finish it's work
If you want to check if a command takes too long to finish its work, you can
use the `run_too_long` and `have_finished_in_time` matchers.

Background:
Given I use a fixture named "cli-app"

Scenario: Check if command runs to long
Given an executable named "bin/aruba-test-cli" with:
"""
#!/bin/bash
sleep 1
"""
And a file named "spec/timeout_spec.rb" with:
Scenario: Check if command runs too long
Given a file named "spec/timeout_spec.rb" with:
"""
require 'spec_helper'

RSpec.describe 'Long running command', :type => :aruba do
before { aruba.config.exit_timeout = 0 }

before { run_command('aruba-test-cli') }
RSpec.describe 'Long running command', type: :aruba do
before { aruba.config.exit_timeout = 0.1 }

it { expect(last_command_started).to run_too_long }
it "runs too long" do
slow_command = which('sleep') ? 'sleep 0.2' : 'timeout 2'
run_command slow_command
expect(last_command_started).to run_too_long
end
end
"""
When I run `rspec`
Then the specs should all pass

Scenario: Check if command finishes in time
Given an executable named "bin/aruba-test-cli" with:
"""
#!/bin/bash
exit 0
"""
And a file named "spec/timeout_spec.rb" with:
Given a file named "spec/timeout_spec.rb" with:
"""
require 'spec_helper'

RSpec.describe 'Short running command', :type => :aruba do
RSpec.describe 'Short running command', type: :aruba do
before { aruba.config.exit_timeout = 5 }

before { run_command('aruba-test-cli') }
it "is done quickly" do
run_command('echo "Fast!"')

it { expect(last_command_started).to have_finished_in_time }
expect(last_command_started).to have_finished_in_time
end
end
"""
When I run `rspec`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Feature: Check if command can be found in PATH
Background:
Given I use a fixture named "cli-app"

Scenario: Checking an existing executable file in PATH
@unsupported-on-platform-windows
Scenario: Checking an existing executable file in PATH on Unix
Given a file named "spec/existing_executable_spec.rb" with:
"""
require 'spec_helper'
Expand All @@ -25,3 +26,24 @@ Feature: Check if command can be found in PATH
"""
When I run `rspec`
Then the specs should all pass

@unsupported-on-platform-unix
Scenario: Checking an existing executable file in PATH on Windows
Given a file named "spec/existing_executable_spec.rb" with:
"""
require 'spec_helper'

RSpec.describe 'Check if command can be found in PATH', type: :aruba do
let(:file) { 'foo.bat' }

before do
touch(file)
chmod(0o755, file)
prepend_environment_variable('PATH', format('%s:', expand_path('.')))
end

it { expect(file).to be_a_command_found_in_path }
end
"""
When I run `rspec`
Then the specs should all pass
30 changes: 30 additions & 0 deletions features/step_definitions/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,36 @@
skip_this_scenario
end

Before "@requires-bash" do
next unless Aruba.platform.which("bash").nil?

skip_this_scenario
end

Before "@requires-sleep" do
next unless Aruba.platform.which("sleep").nil?

skip_this_scenario
end

Before "@requires-env" do
next unless Aruba.platform.which("env").nil?

skip_this_scenario
end

Before "@requires-cat" do
next unless Aruba.platform.which("cat").nil?

skip_this_scenario
end

Before "@requires-platform-windows" do
next if FFI::Platform.windows?

skip_this_scenario
end

Before "@requires-posix-standard-tools" do
next unless Aruba.platform.which("printf").nil?

Expand Down
Loading
Loading