| 1 |
Feature: Basic directory layout (Variant 1) |
| 2 |
|
| 3 |
As a story/test writer |
| 4 |
I want a simple, non-deep directory structure |
| 5 |
So that I can easily get an overview which stories/tests exist |
| 6 |
|
| 7 |
. BASIC DIRECTORY LAYOUT STRUCTURE: |
| 8 |
. features/ |
| 9 |
. +-- steps/*.py # Step definitions or step-library imports. |
| 10 |
. +-- *.feature # Feature files. |
| 11 |
. +-- environment.py # OPTIONAL: environment setup/hooks. |
| 12 |
. |
| 13 |
. SEE ALSO: |
| 14 |
. * http://pythonhosted.org/behave/gherkin.html#layout-variations |
| 15 |
|
| 16 |
|
| 17 |
@setup |
| 18 |
Scenario: Setup directory structure |
| 19 |
Given a new working directory |
| 20 |
And a file named "features/steps/steps.py" with: |
| 21 |
""" |
| 22 |
from behave import step |
| 23 |
|
| 24 |
@step('{word:w} step passes') |
| 25 |
def step_passes(context, word): |
| 26 |
pass |
| 27 |
|
| 28 |
@step('{word:w} step fails') |
| 29 |
def step_fails(context, word): |
| 30 |
assert False, "XFAIL-STEP" |
| 31 |
""" |
| 32 |
And a file named "features/alice.feature" with: |
| 33 |
""" |
| 34 |
Feature: Alice |
| 35 |
Scenario: A1 |
| 36 |
Given a step passes |
| 37 |
When another step passes |
| 38 |
Then a step passes |
| 39 |
""" |
| 40 |
And a file named "features/bob.feature" with: |
| 41 |
""" |
| 42 |
Feature: Bob |
| 43 |
Scenario: B1 |
| 44 |
When a step passes |
| 45 |
Then another step passes |
| 46 |
""" |
| 47 |
|
| 48 |
|
| 49 |
Scenario: Run behave with feature directory |
| 50 |
When I run "behave -f progress features/" |
| 51 |
Then it should pass with: |
| 52 |
""" |
| 53 |
2 features passed, 0 failed, 0 skipped |
| 54 |
2 scenarios passed, 0 failed, 0 skipped |
| 55 |
5 steps passed, 0 failed, 0 skipped, 0 undefined |
| 56 |
""" |
| 57 |
|
| 58 |
Scenario: Run behave with one feature file |
| 59 |
When I run "behave -f progress features/alice.feature" |
| 60 |
Then it should pass with: |
| 61 |
""" |
| 62 |
1 feature passed, 0 failed, 0 skipped |
| 63 |
1 scenario passed, 0 failed, 0 skipped |
| 64 |
3 steps passed, 0 failed, 0 skipped, 0 undefined |
| 65 |
""" |
| 66 |
|
| 67 |
|
| 68 |
Scenario: Run behave with two feature files |
| 69 |
When I run "behave -f progress features/alice.feature features/bob.feature" |
| 70 |
Then it should pass with: |
| 71 |
""" |
| 72 |
2 features passed, 0 failed, 0 skipped |
| 73 |
2 scenarios passed, 0 failed, 0 skipped |
| 74 |
5 steps passed, 0 failed, 0 skipped, 0 undefined |
| 75 |
""" |