cuke_profiles 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +4 -98
- data/cuke_profiles.gemspec +12 -0
- data/lib/cuke_profiles/version.rb +1 -1
- metadata +8 -5
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,103 +1,9 @@
|
|
1
|
-
# Cuke Profiles
|
1
|
+
# Cuke Profiles
|
2
2
|
|
3
3
|
Multiple invocations of your scenarios, without running Cucumber multiple times.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Renamed!
|
6
6
|
|
7
|
-
|
7
|
+
This gem has been *renamed* and can now be found at [cuke_iterations](https://github.com/jmerrifield/cuke_iterations).
|
8
8
|
|
9
|
-
|
10
|
-
* Different platforms (run all my tests against a Windows installation, Linux, OS X etc)
|
11
|
-
* Some types of multi-tenant scenarios (run all my tests against the Initrode deployment, the Acme deployment etc)
|
12
|
-
* Systems which have different, configurable, modes of operation (but behave the same externally) - got a system that can optionally use MySQL, Sqlite or Oracle as the data store?
|
13
|
-
|
14
|
-
## Surely there's some way of doing that already?
|
15
|
-
|
16
|
-
The only way of 'iterating' over a scenario in Cucumber is to provide it with example rows. You certainly don't want a table of 'devices' under every single scenario.
|
17
|
-
|
18
|
-
## Damn right. I can just call Cucumber multiple times from a Rake script though!
|
19
|
-
|
20
|
-
Absolutely. It's not without disadvantages though:
|
21
|
-
|
22
|
-
* Rake will naturally stop after the first failed command, so you have to code around that fact to have Rake ignore the cucumber failures, and fail at the end if any of the Cucumber runs had failures.
|
23
|
-
* No aggregation of results - you have to write your own result aggregation code to get an overall view of how all the variations of your tests did.
|
24
|
-
* When your Cucumber suite gets quite large, it can take a significant chunk of time for Cucumber to run your `env.rb` code, and load up all your support and feature files. That overhead, multiplied by the number of variations, can really add up.
|
25
|
-
|
26
|
-
## So how does this gem work?
|
27
|
-
|
28
|
-
It's very simple. Cucumber can accept a file specifying a list of exact scenarios to run, in the format `filename:line_number`. This is used to re-run failed scenarios, usually in conjunction with the 'rerun' formatter. This gem takes advantage of that, to send Cucumber a long list of all your scenarios, repeated for each profile.
|
29
|
-
|
30
|
-
## How do I use it?
|
31
|
-
|
32
|
-
First, install the gem: `gem install cuke_profiles`
|
33
|
-
|
34
|
-
### Configuration - profiles.yml
|
35
|
-
|
36
|
-
In your `features` folder, create a YAML file to contain your profiles. Each one must have a set of included and excluded tags, e.g:
|
37
|
-
|
38
|
-
```yaml
|
39
|
-
iphone:
|
40
|
-
:include_tags:
|
41
|
-
- ! '@mobile'
|
42
|
-
- ! '@iphone_only'
|
43
|
-
:exclude_tags: []
|
44
|
-
android:
|
45
|
-
:include_tags:
|
46
|
-
- ! '@mobile'
|
47
|
-
:exclude_tags:
|
48
|
-
- ! '@iphone_only'
|
49
|
-
```
|
50
|
-
|
51
|
-
At present, you *must* specify all tags that are to be included. Excluded tags have priority over included ones (e.g. an `@iphone_only` scenario would not be included in the `android` profile, even if it had the `@mobile` tag.
|
52
|
-
|
53
|
-
### Running it
|
54
|
-
|
55
|
-
`cd features`
|
56
|
-
|
57
|
-
With defaults:
|
58
|
-
`cuke_profiles`
|
59
|
-
|
60
|
-
To see other options:
|
61
|
-
`cuke_profiles -h`
|
62
|
-
|
63
|
-
### What did it do?
|
64
|
-
|
65
|
-
First, it created a set of empty directories under the `profiles` folder - one for each profile that you defined. You should add this folder to your source-control ignore list (unless you're using Git which doesn't track empty folders).
|
66
|
-
|
67
|
-
Next, it created a run file for Cucumber. If you didn't specify a filename it will be called `run.txt`. Definitely add this to your source-control ignore list.
|
68
|
-
|
69
|
-
### Run Cucumber with the run file instead of a features folder
|
70
|
-
|
71
|
-
`cucumber @run.txt`
|
72
|
-
|
73
|
-
Note we haven't told Cucumber about our `features` folder like we normally would. This also means it doesn't know about your `support` or `step_definitions` folders, so make sure to add those to the command-line as well.
|
74
|
-
|
75
|
-
### Use the profiles inside your scenarios
|
76
|
-
|
77
|
-
In `env.rb`:
|
78
|
-
|
79
|
-
```ruby
|
80
|
-
require 'cuke_profiles'
|
81
|
-
World(CukeProfiles::CucumberHelper)
|
82
|
-
```
|
83
|
-
|
84
|
-
Create a 'Before' hook:
|
85
|
-
|
86
|
-
```ruby
|
87
|
-
Before do |scenario|
|
88
|
-
profile = current_profile(scenario)
|
89
|
-
puts "I'm running under the '#{profile}' profile!"
|
90
|
-
end
|
91
|
-
```
|
92
|
-
|
93
|
-
### What should I do now I know which profile the scenario is running under?
|
94
|
-
|
95
|
-
You should `puts` the profile name to distinguish between instances of the scenario in the Cucumber output.
|
96
|
-
|
97
|
-
Depending upon the nature of your profiles, you might like to:
|
98
|
-
|
99
|
-
* Switch the browser driver to a device-specific one
|
100
|
-
* Change the URL you're running tests against
|
101
|
-
* Change the configuration of the system under test
|
102
|
-
|
103
|
-
Happy cuking!
|
9
|
+
Why the change? Immediately after publishing the gem under `cuke_profiles`, I remembered that Cucumber already has a profile feature with a much different purpose to this gem! After much cursing at myself, I think the new name better reflects what this actually does.
|
data/cuke_profiles.gemspec
CHANGED
@@ -18,4 +18,16 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
s.add_dependency 'gherkin'
|
21
|
+
|
22
|
+
s.post_install_message =<<msg
|
23
|
+
********************************************************************************
|
24
|
+
|
25
|
+
This gem has been renamed to 'cuke_iterations'!
|
26
|
+
|
27
|
+
Please run 'gem install cuke_iterations' to get the new gem. It's homepage is at https://github.com/jmerrifield/cuke_iterations.
|
28
|
+
|
29
|
+
This version will not be developed further.
|
30
|
+
|
31
|
+
********************************************************************************
|
32
|
+
msg
|
21
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuke_profiles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-27 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gherkin
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153091440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153091440
|
25
25
|
description: Run your Cucumber features multiple times within one Cucumber invocation
|
26
26
|
email:
|
27
27
|
- jon@jmerrifield.com
|
@@ -55,7 +55,10 @@ files:
|
|
55
55
|
- spec/spec_helper.rb
|
56
56
|
homepage: https://github.com/jmerrifield/cuke_profiles
|
57
57
|
licenses: []
|
58
|
-
post_install_message:
|
58
|
+
post_install_message: ! "********************************************************************************\n\n
|
59
|
+
\ This gem has been renamed to 'cuke_iterations'!\n\n Please run 'gem install cuke_iterations'
|
60
|
+
to get the new gem. It's homepage is at https://github.com/jmerrifield/cuke_iterations.\n\n
|
61
|
+
\ This version will not be developed further.\n\n********************************************************************************\n"
|
59
62
|
rdoc_options: []
|
60
63
|
require_paths:
|
61
64
|
- lib
|