-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-organize and improve output check scenarios
- Move scenarios for checking success + output to a separate feature - Unify order and implementation of scenarios for checking output, stderr and stdout
- Loading branch information
Showing
4 changed files
with
231 additions
and
246 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
features/03_testing_frameworks/cucumber/steps/command/check_for_success_and_output.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Feature: Checking success and output together | ||
|
||
In order to specify expected output and success | ||
As a developer using Cucumber | ||
I want to use the "it should pass with" step family | ||
|
||
Background: | ||
Given I use a fixture named "cli-app" | ||
|
||
Scenario: Match passing exit status and partial output | ||
Given a file named "features/output.feature" with: | ||
"""cucumber | ||
Feature: Run command | ||
Scenario: Run command | ||
When I run `echo hello world` | ||
Then it should pass with: | ||
\"\"\" | ||
hello | ||
\"\"\" | ||
""" | ||
When I run `cucumber` | ||
Then the features should all pass | ||
|
||
Scenario: Match passing exit status and exact output | ||
Given a file named "features/output.feature" with: | ||
"""cucumber | ||
Feature: Run command | ||
Scenario: Run command | ||
When I run `ruby -e 'puts "hello\nworld"; exit 0'` | ||
Then it should pass with exactly: | ||
\"\"\" | ||
hello | ||
world | ||
\"\"\" | ||
""" | ||
When I run `cucumber` | ||
Then the features should all pass | ||
|
||
Scenario: Match failing exit status and partial output | ||
Given a file named "features/output.feature" with: | ||
"""cucumber | ||
Feature: Run command | ||
Scenario: Run command | ||
When I run `ruby -e 'puts "hello\nworld"; exit 1'` | ||
Then it should fail with: | ||
\"\"\" | ||
hello | ||
\"\"\" | ||
""" | ||
When I run `cucumber` | ||
Then the features should all pass | ||
|
||
Scenario: Match failing exit status and exact output | ||
Given a file named "features/output.feature" with: | ||
"""cucumber | ||
Feature: Run command | ||
Scenario: Run command | ||
When I run `ruby -e 'puts "hello\nworld"; exit 1'` | ||
Then it should fail with exactly: | ||
\"\"\" | ||
hello | ||
world | ||
\"\"\" | ||
""" | ||
When I run `cucumber` | ||
Then the features should all pass | ||
|
||
Scenario: Match failing exit status and output with regex | ||
Given a file named "features/output.feature" with: | ||
"""cucumber | ||
Feature: Run command | ||
Scenario: Run command | ||
When I run `ruby -e 'puts "hello\nworld"; exit 1'` | ||
Then it should fail with regex: | ||
\"\"\" | ||
hello\s*world | ||
\"\"\" | ||
""" | ||
When I run `cucumber` | ||
Then the features should all pass | ||
|
||
Scenario: Detect output from all processes | ||
Given a file named "features/output.feature" with: | ||
"""cucumber | ||
Feature: Run command | ||
Scenario: Run command | ||
When I run `echo hello` | ||
And I run `echo good-bye` | ||
Then the stdout should contain exactly: | ||
\"\"\" | ||
hello | ||
good-bye | ||
\"\"\" | ||
""" | ||
When I run `cucumber` | ||
Then the features should all pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.