forked from cucumber/cucumber-ruby
/
profiles.feature
99 lines (82 loc) · 3.4 KB
/
profiles.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Feature: Profiles
In order to save time and prevent carpal tunnel syndrome
Cucumber users can save and reuse commonly used cucumber flags in a 'cucumber.yml' file.
These named arguments are called profiles and the yml file should be in the root of your project.
Any cucumber argument is valid in a profile. To see all the available flags type 'cucumber --help'
For more information about profiles please see the wiki:
http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml
Background: Basic App
Given a standard Cucumber project directory structure
And a file named "features/sample.feature" with:
"""
Feature: Sample
Scenario: this is a test
Given I am just testing stuff
"""
And a file named "features/support/env.rb"
And a file named "features/support/super_env.rb"
And the following profiles are defined:
"""
default: features/sample.feature --require features/support/env.rb -v
super: features/sample.feature --require features/support/super_env.rb -v
"""
Scenario: Explicitly defining a profile to run
When I run cucumber features/sample.feature --profile super
Then the output should contain
"""
Using the super profile...
"""
And exactly these files should be loaded: features/support/super_env.rb
Scenario: Defining multiple profiles to run
When I run cucumber features/sample.feature --profile default --profile super
Then the output should contain
"""
Using the default and super profiles...
"""
And exactly these files should be loaded: features/support/env.rb, features/support/super_env.rb
Scenario: Arguments passed in but no profile specified
When I run cucumber -v
Then the default profile should be used
And exactly these files should be loaded: features/support/env.rb
Scenario: Trying to use a missing profile
When I run cucumber -p foo
Then STDERR should be
"""
Could not find profile: 'foo'
Defined profiles in cucumber.yml:
* default
* super
"""
Scenario Outline: Disabling the default profile
When I run cucumber -v features/ <Flag>
Then the output should contain
"""
Disabling profiles...
"""
And exactly these files should be loaded: features/support/env.rb, features/support/super_env.rb
Examples:
| Flag |
| -P |
| --no-profile |
Scenario: Overriding the profile's features to run
Given a file named "features/another.feature" with:
"""
Feature: Just this one should be ran
"""
When I run cucumber -p default features/another.feature
Then exactly these features should be ran: features/another.feature
Scenario: Overriding the profile's formatter
You will most likely want to define a formatter in your default formatter.
However, you often want to run your features with a different formatter
yet still use the other the other arguments in the profile. Cucumber will
allow you to do this by giving precedence to the formatter specified on the
command line and override the one in the profile.
Given the following profiles are defined:
"""
default: features/sample.feature --require features/support/env.rb -v --format profile
"""
When I run cucumber features --format pretty
And the output should contain
"""
Feature: Sample
"""