Debian Codegraph @

features/configuration.default_paths.feature

raw
1 @sequential
2 Feature: Default paths for features in behave configfile
3
4 As a tester
5 I want to specify the default paths for features in the configuration file
6 That should be used if none are provided as command-line args
7 To support pre-pared/canned test environments
8 (and to support my laziness while using behave in a shell).
9
10
11 @setup
12 Scenario: Test Setup
13 Given a new working directory
14 And a file named "features/steps/steps.py" with:
15 """
16 from behave import step
17
18 @step('a step passes')
19 def step_passes(context):
20 pass
21 """
22 And a file named "features/alice.feature" with:
23 """
24 Feature: Alice
25 Scenario: A1
26 Given a step passes
27 When a step passes
28 Then a step passes
29 """
30 And a file named "features/bob.feature" with:
31 """
32 Feature: Bob
33 Scenario: B1
34 When a step passes
35 """
36 And a file named "more.features/charly.feature" with:
37 """
38 Feature: Charly
39 Scenario: C1
40 Then a step passes
41 """
42 And a file named "behave.ini" with:
43 """
44 [behave]
45 show_timings = false
46 paths = features/bob.feature
47 more.features/charly.feature
48 """
49
50 Scenario: Used default paths from behave configfile
51 When I run "behave -f plain"
52 Then it should pass with:
53 """
54 2 features passed, 0 failed, 0 skipped
55 2 scenarios passed, 0 failed, 0 skipped
56 """
57 And the command output should contain:
58 """
59 Feature: Bob
60 Scenario: B1
61 When a step passes ... passed
62
63 Feature: Charly
64 Scenario: C1
65 Then a step passes ... passed
66 """
67 But the command output should not contain:
68 """
69 Feature: Alice
70 """
71
72 Scenario: Command-line args can override default paths in configfile
73 When I run "behave -f plain features/alice.feature"
74 Then it should pass with:
75 """
76 1 feature passed, 0 failed, 0 skipped
77 1 scenario passed, 0 failed, 0 skipped
78 3 steps passed, 0 failed, 0 skipped, 0 undefined
79 """
80 And the command output should contain:
81 """
82 Feature: Alice
83 Scenario: A1
84 """
85 But the command output should not contain:
86 """
87 Feature: Bob
88 """
89 And the command output should not contain:
90 """
91 Feature: Charly
92 """
93
94 Scenario: Command-line args are provided (CASE 2)
95 When I run "behave -f plain features"
96 Then it should pass with:
97 """
98 2 features passed, 0 failed, 0 skipped
99 2 scenarios passed, 0 failed, 0 skipped
100 """
101 And the command output should contain:
102 """
103 Feature: Alice
104 Scenario: A1
105 Given a step passes ... passed
106 When a step passes ... passed
107 Then a step passes ... passed
108
109 Feature: Bob
110 Scenario: B1
111 When a step passes ... passed
112 """
113 But the command output should not contain:
114 """
115 Feature: Charly
116 """