2
In order to save time and prevent carpal tunnel syndrome
3
Cucumber users can save and reuse commonly used cucumber flags in a 'cucumber.yml' file.
4
These named arguments are called profiles and the yml file should be in the root of your project.
5
Any cucumber argument is valid in a profile. To see all the available flags type 'cucumber --help'
6
For more information about profiles please see the wiki:
7
http://wiki.github.com/cucumber/cucumber/cucumber.yml
10
Given a standard Cucumber project directory structure
11
And a file named "features/sample.feature" with:
14
Scenario: this is a test
15
Given I am just testing stuff
17
And a file named "features/support/env.rb"
18
And a file named "features/support/super_env.rb"
19
And the following profiles are defined:
21
default: features/sample.feature --require features/support/env.rb -v
22
super: features/sample.feature --require features/support/super_env.rb -v
25
Scenario: Explicitly defining a profile to run
26
When I run cucumber features/sample.feature --profile super
27
Then the output should contain
29
Using the super profile...
31
And exactly these files should be loaded: features/support/super_env.rb
33
Scenario: Explicitly defining a profile defined in an ERB formatted file
34
Given the following profiles are defined:
36
<% requires = "--require features/support/super_env.rb" %>
37
super: <%= "features/sample.feature #{requires} -v" %>
39
When I run cucumber features/sample.feature --profile super
40
Then the output should contain
42
Using the super profile...
44
And exactly these files should be loaded: features/support/super_env.rb
46
Scenario: Defining multiple profiles to run
47
When I run cucumber features/sample.feature --profile default --profile super
48
Then the output should contain
50
Using the default and super profiles...
52
And exactly these files should be loaded: features/support/env.rb, features/support/super_env.rb
54
Scenario: Arguments passed in but no profile specified
55
When I run cucumber -v
56
Then the default profile should be used
57
And exactly these files should be loaded: features/support/env.rb
59
Scenario: Trying to use a missing profile
60
When I run cucumber -p foo
63
Could not find profile: 'foo'
65
Defined profiles in cucumber.yml:
71
Scenario Outline: Disabling the default profile
72
When I run cucumber -v features/ <Flag>
73
Then the output should contain
77
And exactly these files should be loaded: features/support/env.rb, features/support/super_env.rb
85
Scenario: Overriding the profile's features to run
86
Given a file named "features/another.feature" with:
88
Feature: Just this one should be ran
90
When I run cucumber -p default features/another.feature
91
Then exactly these features should be ran: features/another.feature
93
Scenario: Overriding the profile's formatter
94
You will most likely want to define a formatter in your default formatter.
95
However, you often want to run your features with a different formatter
96
yet still use the other the other arguments in the profile. Cucumber will
97
allow you to do this by giving precedence to the formatter specified on the
98
command line and override the one in the profile.
100
Given the following profiles are defined:
102
default: features/sample.feature --require features/support/env.rb -v --format profile
104
When I run cucumber features --format pretty
105
And the output should contain
110
Scenario Outline: Showing profiles when listing failing scenarios
111
Given a file named "features/step_definitions/steps.rb" with:
113
Given /^I am just testing stuff$/ do
117
When I run cucumber -q -p super -p default -f <format> features/sample.feature --require features/step_definitions/steps.rb
119
And the output should contain
121
cucumber -p super features/sample.feature:2