| 1 |
@issue |
| 2 |
Feature: Issue #46 Behave returns 0 (SUCCESS) even in case of test failures |
| 3 |
|
| 4 |
As I behave user |
| 5 |
I want to detect test success or test failures |
| 6 |
By using the process return value, 0 (SUCCESS) and non-zero for failure. |
| 7 |
|
| 8 |
Background: Test Setup |
| 9 |
Given a new working directory |
| 10 |
Given a file named "features/steps/steps.py" with: |
| 11 |
""" |
| 12 |
from behave import given |
| 13 |
|
| 14 |
@given(u'passing') |
| 15 |
def step(context): |
| 16 |
pass |
| 17 |
|
| 18 |
@given(u'failing') |
| 19 |
def step(context): |
| 20 |
assert False, "failing" |
| 21 |
""" |
| 22 |
|
| 23 |
Scenario: Successful Execution |
| 24 |
Given a file named "features/passing.feature" with: |
| 25 |
""" |
| 26 |
Feature: Passing |
| 27 |
Scenario: Passing Scenario Example |
| 28 |
Given passing |
| 29 |
""" |
| 30 |
When I run "behave -c -q features/passing.feature" |
| 31 |
Then it should pass with: |
| 32 |
""" |
| 33 |
1 feature passed, 0 failed, 0 skipped |
| 34 |
1 scenario passed, 0 failed, 0 skipped |
| 35 |
1 step passed, 0 failed, 0 skipped, 0 undefined |
| 36 |
""" |
| 37 |
|
| 38 |
Scenario: Failing Execution |
| 39 |
Given a file named "features/failing.feature" with: |
| 40 |
""" |
| 41 |
Feature: Failing |
| 42 |
Scenario: Failing Scenario Example |
| 43 |
Given failing |
| 44 |
""" |
| 45 |
When I run "behave -c -q features/failing.feature" |
| 46 |
Then it should fail with: |
| 47 |
""" |
| 48 |
0 features passed, 1 failed, 0 skipped |
| 49 |
0 scenarios passed, 1 failed, 0 skipped |
| 50 |
0 steps passed, 1 failed, 0 skipped, 0 undefined |
| 51 |
""" |
| 52 |
|
| 53 |
Scenario: Passing and Failing Execution |
| 54 |
Given a file named "features/passing_and_failing.feature" with: |
| 55 |
""" |
| 56 |
Feature: Passing and Failing |
| 57 |
Scenario: Passing Scenario Example |
| 58 |
Given passing |
| 59 |
Scenario: Failing Scenario Example |
| 60 |
Given failing |
| 61 |
""" |
| 62 |
When I run "behave -c -q features/passing_and_failing.feature" |
| 63 |
Then it should fail with: |
| 64 |
""" |
| 65 |
0 features passed, 1 failed, 0 skipped |
| 66 |
1 scenario passed, 1 failed, 0 skipped |
| 67 |
1 step passed, 1 failed, 0 skipped, 0 undefined |
| 68 |
""" |
| 69 |
And the command output should contain: |
| 70 |
""" |
| 71 |
Feature: Passing and Failing |
| 72 |
Scenario: Passing Scenario Example |
| 73 |
Given passing |
| 74 |
Scenario: Failing Scenario Example |
| 75 |
Given failing |
| 76 |
Assertion Failed: failing |
| 77 |
""" |