Skip to content

Commit

Permalink
CI: Windows - Fixed check_for_exit_status feature (Cucumber)
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrasimplicity authored and mvz committed May 19, 2019
1 parent dbfaaaa commit 962157e
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 1 deletion.
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
10 changes: 10 additions & 0 deletions features/step_definitions/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@
end
end

Before '@requires-platform-windows' do |scenario|
next if FFI::Platform.windows?

if Cucumber::VERSION < '2'
scenario.skip_invoke!
else
skip_this_scenario
end
end

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
@requires-platform-windows
Feature: Check exit status of commands

Use the `the exit status should be \d`-step to check the exit status of the
last command which was finished. If no commands have finished yet, it stops
the one that was started last.

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


Scenario: Test for exit status of 0
Given an executable named "bin/aruba-test-cli.bat" with:
"""
exit 0
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Exit status
Scenario: Run command
When I run `aruba-test-cli`
Then the exit status should be 0
"""
When I run `cucumber`
Then the features should all pass

Scenario: Test for exit status 1
Given an executable named "bin/aruba-test-cli.bat" with:
"""
exit 1
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
When I run `aruba-test-cli`
Then the exit status should be 1
"""
When I run `cucumber`
Then the features should all pass

Scenario: Test for non-zero exit status
Given an executable named "bin/aruba-test-cli.bat" with:
"""
exit 1
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
When I run `aruba-test-cli`
Then the exit status should not be 0
"""
When I run `cucumber`
Then the features should all pass

Scenario: Successfully run something
Given an executable named "bin/aruba-test-cli.bat" with:
"""
exit 0
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
When I successfully run `aruba-test-cli`
"""
When I run `cucumber`
Then the features should all pass

Scenario: Fail to run something successfully
Given an executable named "bin/aruba-test-cli.bat" with:
"""
exit 1
"""
And a file named "features/exit_status.feature" with:
"""
Feature: Failing program
Scenario: Run command
When I successfully run `aruba-test-cli`
"""
When I run `cucumber`
Then the features should not all pass

Scenario: Overwrite the default exit timeout via step
Given an executable named "bin/aruba-test-cli.bat" with:
"""
ruby -e '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 3.5 seconds
When I successfully run `aruba-test-cli`
"""
When I run `cucumber`
Then the features should all pass

Scenario: Successfully run something longer then the default time
Given an executable named "bin/aruba-test-cli.bat" with:
"""
ruby -e '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 5.1 seconds
"""
When I run `cucumber`
Then the features should all pass

Scenario: Unsuccessfully run something that takes too long
Given an executable named "bin/aruba-test-cli.bat" with:
"""
ruby -e '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`
"""
When I run `cucumber`
Then the features should not all pass with:
"""
expected "aruba-test-cli" to have finished in time
"""

0 comments on commit 962157e

Please sign in to comment.