chemistrykit 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +12 -0
- data/README.md +143 -6
- data/chemistrykit.gemspec +2 -2
- data/features/brew.feature +22 -1
- data/features/concurrency.feature +48 -15
- data/features/tags.feature +82 -0
- data/lib/chemistrykit/cli/cli.rb +67 -28
- metadata +6 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
#3.3.0 (2013-07-09)
|
2
|
+
Fixed bugs with tagging and concurrency
|
3
|
+
|
4
|
+
- Bumped version to 3.3.0 to prepare for release.
|
5
|
+
- added the ckit tags command to list all tags in the harnes
|
6
|
+
- consolidated documentation into the readme file
|
7
|
+
- fixed code quality issues and a bug with the tag filtering
|
8
|
+
- added the --all flag and tests to run all beakers
|
9
|
+
- fixed tagging issues for concurrent runs, now a beaker specification will override the default tag unless it is explicitly specified.
|
10
|
+
- removed debug info
|
11
|
+
- initial cut on tagging updates
|
12
|
+
|
1
13
|
#3.2.0 (2013-07-08)
|
2
14
|
Updated Selenium Connect
|
3
15
|
|
data/README.md
CHANGED
@@ -5,8 +5,7 @@ Master branch: [![Build Status](https://travis-ci.org/arrgyle/chemistrykit.png?b
|
|
5
5
|
|
6
6
|
Develop branch: [![Build Status](https://travis-ci.org/arrgyle/chemistrykit.png?branch=develop)](https://travis-ci.org/jrobertfox/chef-broiler-platter)
|
7
7
|
|
8
|
-
ChemistryKit
|
9
|
-
============================================================
|
8
|
+
#ChemistryKit
|
10
9
|
|
11
10
|
### A simple and opinionated web testing framework for Selenium WebDriver
|
12
11
|
|
@@ -14,7 +13,16 @@ This framework was designed to help you get started with Selenium WebDriver quic
|
|
14
13
|
|
15
14
|
ChemistryKit's inspiration comes from the Saunter Selenium framework which is available in Python and PHP. You can find more about it [here](http://element34.ca/products/saunter).
|
16
15
|
|
17
|
-
|
16
|
+
All the documentation for ChemistryKit can be found in this README, organized as follows:
|
17
|
+
|
18
|
+
- [Getting Started](#getting-started)
|
19
|
+
- [Building a Test Suite](#building-a-test-suite)
|
20
|
+
- [Configuration](#configuration)
|
21
|
+
- [Command Line Usage](#command-line-usage)
|
22
|
+
- [Contribution Guidelines](#contribution-guidelines)
|
23
|
+
- [Deployment](#deployment)
|
24
|
+
|
25
|
+
##Getting Started
|
18
26
|
|
19
27
|
$ gem install chemistrykit
|
20
28
|
$ ckit new framework_name
|
@@ -28,10 +36,139 @@ This will generate a beaker file (a.k.a. test script) with the name you provide
|
|
28
36
|
|
29
37
|
$ ckit brew
|
30
38
|
|
31
|
-
This will run ckit and execute your beakers. By default it will run the tests locally by default. But you can change where the tests run and all other relevant bits in
|
39
|
+
This will run ckit and execute your beakers. By default it will run the tests locally by default. But you can change where the tests run and all other relevant bits in `config.yaml` file detailed below.
|
40
|
+
|
41
|
+
##Building a Test Suite
|
42
|
+
|
43
|
+
###Spec Discovery
|
44
|
+
|
45
|
+
ChemistryKit is built on top of RSpec. All specs are in the _beaker_ directory and end in _beaker.rb. Rather than being discovered via class or file name as some systems they are by identified by tag.
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
it 'with invalid credentials', :depth => 'shallow' do
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'with invalid credentials', :depth => 'deep' do
|
53
|
+
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
All specs should have at least a :depth tag. The depth should either be 'shallow' or 'deep'. Shallow specs are the ones that are the absolute-must-pass ones. And there will only be a few of them typically. Deep ones are everything else.
|
58
|
+
|
59
|
+
You can add multiple tags as well.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
it 'with invalid credentials', :depth => 'shallow', :authentication => true do
|
63
|
+
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
By default ChemistryKit will discover and run the _:depth => 'shallow'_ scripts. To run different ones you use the --tag option.
|
68
|
+
|
69
|
+
ckit brew --tag authentication
|
70
|
+
|
71
|
+
ckit brew --tag depth:shallow --tag authentication
|
72
|
+
|
73
|
+
To exclude a tag, put a ~ in front of it.
|
74
|
+
|
75
|
+
ckit brew --tag depth:shallow --tag ~authentication
|
76
|
+
|
77
|
+
During development it is often helpful to just run a specific beaker, this can be accomplished with the `--beakers` flag:
|
78
|
+
|
79
|
+
ckit brew --beakers=beakers/wip_beaker.rb
|
80
|
+
|
81
|
+
|
82
|
+
###Formula Loading
|
83
|
+
Code in the `formula` directory can be used to build out page objects and helper functions to facilitate your testing. The files are loaded in a particular way:
|
84
|
+
|
85
|
+
- Files in any `lib` directory are loaded before other directories.
|
86
|
+
- Files in child directories are loaded before those in parent directories.
|
87
|
+
- Files are loaded in alphabetical order.
|
88
|
+
|
89
|
+
So for example if you have a `alpha_page.rb` file in your formulas directory that depends on a `helpers.rb` file, then you best put the `helpers.rb` file in the `lib` directory so it is loaded before the file that depends on it.
|
90
|
+
|
91
|
+
###Execution Order
|
92
|
+
Chemistry Kit executes specs in a random order. This is intentional. Knowing the order a spec will be executed in allows for dependencies between them to creep in. Sometimes unintentionally. By having them go in a random order parallelization becomes a much easier.
|
93
|
+
|
94
|
+
###Before and After
|
95
|
+
Chemistry Kit uses the 4-phase model for scripts with a chunk of code that gets run before and after each method. By default, it does nothing more than launch a browser instance that your configuration says you want. If you want to do something more than that, just add it to your spec.
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
before(:each) do
|
99
|
+
# something here
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
103
|
+
You can even nest them inside different describe/context blocks and they will get executed from the outside-in.
|
104
|
+
|
105
|
+
###Logs and CI Integration
|
106
|
+
Each run of Chemistry Kit saves logging and test output to the _evidence_ directory by default. And in there will be the full set of JUnit Ant XML files that may be consumed by your CI.
|
107
|
+
|
108
|
+
##Configuration
|
109
|
+
ChemistryKit is configured by default with a `config.yaml` file that is created for you when you scaffold out a test harness. Relevant configuration options are detailed below:
|
110
|
+
|
111
|
+
`base_url:` The base url of your app, stored to the ENV for access in your beakers and formulas.
|
112
|
+
|
113
|
+
`concurrency:` You may override the default concurrency of 1 to run the tests in parallel
|
114
|
+
|
115
|
+
`log: path:` You may override the default log path 'evidence'
|
116
|
+
|
117
|
+
`log: results_file:` You may override the default file name 'results_junit.xml'
|
118
|
+
|
119
|
+
`log: format:` You may override the default format 'junit' to an alternative like 'doc' or 'html'
|
120
|
+
|
121
|
+
`selenium_connect:` Options in this node override the defaults for the [Selenium Connect](https://github.com/arrgyle/selenium-connect) gem.
|
122
|
+
##Command Line Usage
|
123
|
+
|
124
|
+
###new
|
125
|
+
Creates a new ChemistryKit project.
|
126
|
+
|
127
|
+
Usage:
|
128
|
+
|
129
|
+
ckit new [NAME]
|
130
|
+
|
131
|
+
###brew
|
132
|
+
Executes your test cases.
|
133
|
+
|
134
|
+
Usage:
|
135
|
+
|
136
|
+
ckit brew [OPTIONS]
|
137
|
+
|
138
|
+
Available options for the `brew` command:
|
139
|
+
|
140
|
+
```
|
141
|
+
-a, --all Run every beaker regardless of tag.
|
142
|
+
-b, --beakers [BEAKERS] Pass a list of beaker paths to be executed.
|
143
|
+
-c, --config [PATH] Pass the path to an alternative config.yaml file.
|
144
|
+
-r, --results_file [NAME] Specify the name of your results file.
|
145
|
+
--tag [TAGS] Specify a list of tags to run or exclude.
|
146
|
+
--params [HASH] Send a list of "key:value" parameters to the ENV.
|
147
|
+
```
|
148
|
+
|
149
|
+
###generate forumla
|
150
|
+
Creates a new boilerplate formula object.
|
151
|
+
|
152
|
+
Usage:
|
153
|
+
|
154
|
+
ckit generate formula [NAME]
|
155
|
+
|
156
|
+
|
157
|
+
###generate beaker
|
158
|
+
Creates a new boilerplate beaker object.
|
159
|
+
|
160
|
+
Usage:
|
161
|
+
|
162
|
+
ckit generate beaker [NAME]
|
163
|
+
|
164
|
+
###tags
|
165
|
+
Lists all the tags you have used in your beakers.
|
166
|
+
|
167
|
+
Usage:
|
32
168
|
|
169
|
+
ckit tags
|
33
170
|
|
34
|
-
##
|
171
|
+
##Contribution Guidelines
|
35
172
|
This project conforms to the [neverstopbuilding/craftsmanship](https://github.com/neverstopbuilding/craftsmanship) guidelines. Please see them for details on:
|
36
173
|
- Branching theory
|
37
174
|
- Documentation expectations
|
@@ -57,7 +194,7 @@ All issues and questions related to this project should be logged using the [git
|
|
57
194
|
|
58
195
|
ckit
|
59
196
|
|
60
|
-
##
|
197
|
+
##Deployment
|
61
198
|
The release process is rather automated, just use one rake task with the new version number:
|
62
199
|
|
63
200
|
rake release_start['2.1.0']
|
data/chemistrykit.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "chemistrykit"
|
5
|
-
s.version = "3.
|
5
|
+
s.version = "3.3.0"
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
s.authors = ["Dave Haeffner", "Jason Fox"]
|
8
8
|
s.email = ["dave@arrgyle.com", "jason@arrgyle.com"]
|
9
9
|
s.homepage = "https://github.com/arrgyle/chemistrykit"
|
10
10
|
s.summary = "A simple and opinionated web testing framework for Selenium that follows convention over configuration."
|
11
|
-
s.description = "
|
11
|
+
s.description = "Fixed bugs with tagging and concurrency"
|
12
12
|
s.license = 'MIT'
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split($/)
|
data/features/brew.feature
CHANGED
@@ -29,6 +29,7 @@ Feature: Brewing a ChemistryKit project
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
"""
|
32
|
+
|
32
33
|
Scenario: Localhost
|
33
34
|
Given a file named "config.yaml" with:
|
34
35
|
"""
|
@@ -68,7 +69,7 @@ Feature: Brewing a ChemistryKit project
|
|
68
69
|
"""
|
69
70
|
And a file named "beakers/other_beaker.rb" with:
|
70
71
|
"""
|
71
|
-
describe "Other"
|
72
|
+
describe "Other" do
|
72
73
|
let(:book) { Formulas::Bookie.new(@driver) }
|
73
74
|
|
74
75
|
it "loads an external web page" do
|
@@ -79,3 +80,23 @@ Feature: Brewing a ChemistryKit project
|
|
79
80
|
When I run `ckit brew --beakers=beakers/other_beaker.rb`
|
80
81
|
Then the stdout should contain "1 example, 0 failures"
|
81
82
|
|
83
|
+
Scenario: Run all the tests regardless of tag
|
84
|
+
Given a file named "config.yaml" with:
|
85
|
+
"""
|
86
|
+
selenium_connect:
|
87
|
+
log: 'evidence'
|
88
|
+
host: 'localhost'
|
89
|
+
"""
|
90
|
+
And a file named "beakers/other_beaker.rb" with:
|
91
|
+
"""
|
92
|
+
describe "Other" do
|
93
|
+
let(:book) { Formulas::Bookie.new(@driver) }
|
94
|
+
|
95
|
+
it "loads an external web page" do
|
96
|
+
book.open "http://www.google.com"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
"""
|
100
|
+
When I run `ckit brew --all`
|
101
|
+
Then the stdout should contain "2 examples, 0 failures"
|
102
|
+
|
@@ -28,9 +28,7 @@ Feature: Support for concurency
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
"""
|
31
|
-
|
32
|
-
Scenario: I can run the tests in parallel
|
33
|
-
When I overwrite config.yaml with:
|
31
|
+
And I overwrite config.yaml with:
|
34
32
|
"""
|
35
33
|
concurrency: 4
|
36
34
|
selenium_connect:
|
@@ -41,6 +39,8 @@ Feature: Support for concurency
|
|
41
39
|
sauce_api_key: 'ab7a6e17-16df-42d2-9ef6-c8d2539cc38a'
|
42
40
|
description: 'concurrency check'
|
43
41
|
"""
|
42
|
+
|
43
|
+
Scenario: I can run the tests in parallel
|
44
44
|
When I run `ckit brew`
|
45
45
|
Then the stdout should contain "4 processes for 2 beakers"
|
46
46
|
And the stdout should contain "3 examples, 0 failures"
|
@@ -48,17 +48,50 @@ Feature: Support for concurency
|
|
48
48
|
And there should be "2" unique results files in the "evidence" directory
|
49
49
|
|
50
50
|
Scenario: I can run a specific beaker in parallel
|
51
|
-
When I
|
51
|
+
When I run `ckit brew --beakers=beakers/first_beaker.rb`
|
52
|
+
Then the stdout should contain "4 processes for 1 beakers"
|
53
|
+
And the stdout should contain "2 examples, 0 failures"
|
54
|
+
|
55
|
+
Scenario: I can run specific beakers by tag in parallel
|
56
|
+
Given a file named "beakers/tagged_beaker_1.rb" with:
|
52
57
|
"""
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
describe "Cheese 3", :item => 'test' do
|
59
|
+
it "loads an external web page" do
|
60
|
+
@driver.get "http://www.google.com"
|
61
|
+
@driver.title.should include("Google")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
"""
|
65
|
+
And a file named "beakers/tagged_beaker_2.rb" with:
|
66
|
+
"""
|
67
|
+
describe "Cheese 4", :item => 'test' do
|
68
|
+
it "loads an external web page" do
|
69
|
+
@driver.get "http://www.google.com"
|
70
|
+
@driver.title.should include("Google")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
"""
|
74
|
+
When I run `ckit brew --tag item:test`
|
75
|
+
And the stdout should contain "2 examples, 0 failures"
|
76
|
+
|
77
|
+
Scenario: I can all beakers in parallel
|
78
|
+
Given a file named "beakers/tagged_beaker_1.rb" with:
|
79
|
+
"""
|
80
|
+
describe "Cheese 3", :item => 'test' do
|
81
|
+
it "loads an external web page" do
|
82
|
+
@driver.get "http://www.google.com"
|
83
|
+
@driver.title.should include("Google")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
"""
|
87
|
+
And a file named "beakers/tagged_beaker_2.rb" with:
|
88
|
+
"""
|
89
|
+
describe "Cheese 4", :item => 'test' do
|
90
|
+
it "loads an external web page" do
|
91
|
+
@driver.get "http://www.google.com"
|
92
|
+
@driver.title.should include("Google")
|
93
|
+
end
|
94
|
+
end
|
61
95
|
"""
|
62
|
-
|
63
|
-
|
64
|
-
And the stdout should contain "2 examples, 0 failures"
|
96
|
+
When I run `ckit brew --all`
|
97
|
+
And there should be "4" unique results files in the "evidence" directory
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Feature: Listing all the tags
|
2
|
+
In order to see all the tags I'm using
|
3
|
+
As a harness developer
|
4
|
+
I want to run a command to list all the tags
|
5
|
+
|
6
|
+
Background: Setup the project
|
7
|
+
Given I run `ckit new tags-test`
|
8
|
+
And I cd to "tags-test"
|
9
|
+
|
10
|
+
Scenario: Get the tag for a single beaker
|
11
|
+
Given a file named "beakers/bookie_beaker.rb" with:
|
12
|
+
"""
|
13
|
+
describe "Bookie", :depth => 'shallow' do
|
14
|
+
let(:book) { Formulas::Bookie.new(@driver) }
|
15
|
+
|
16
|
+
it "loads an external web page" do
|
17
|
+
book.open "http://www.google.com"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
"""
|
21
|
+
When I run `ckit tags`
|
22
|
+
Then the stdout should contain "depth:shallow"
|
23
|
+
|
24
|
+
Scenario: Get the tags inside a beaker
|
25
|
+
Given a file named "beakers/bookie_beaker.rb" with:
|
26
|
+
"""
|
27
|
+
describe "Bookie" do
|
28
|
+
let(:book) { Formulas::Bookie.new(@driver) }
|
29
|
+
|
30
|
+
it "loads an external web page", :depth => 'shallow' do
|
31
|
+
book.open "http://www.google.com"
|
32
|
+
end
|
33
|
+
it "loads an external web page", :depth => 'deep' do
|
34
|
+
book.open "http://www.google.com"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
"""
|
38
|
+
When I run `ckit tags`
|
39
|
+
Then the stdout should contain "depth:shallow"
|
40
|
+
And the stdout should contain "depth:deep"
|
41
|
+
|
42
|
+
Scenario: The tags should be unique and in alpha order
|
43
|
+
Given a file named "beakers/bookie_beaker.rb" with:
|
44
|
+
"""
|
45
|
+
describe "Bookie" do
|
46
|
+
let(:book) { Formulas::Bookie.new(@driver) }
|
47
|
+
|
48
|
+
it "loads an external web page", :aaa => 'ccc' do
|
49
|
+
book.open "http://www.google.com"
|
50
|
+
end
|
51
|
+
it "loads an external web page", :bbb => 'ddd' do
|
52
|
+
book.open "http://www.google.com"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
"""
|
56
|
+
And a file named "beakers/bookie_other.rb" with:
|
57
|
+
"""
|
58
|
+
describe "Other", :depth => 'shallow' do
|
59
|
+
let(:book) { Formulas::Bookie.new(@driver) }
|
60
|
+
|
61
|
+
it "loads an external web page", :bbb => 'aaa' do
|
62
|
+
book.open "http://www.google.com"
|
63
|
+
end
|
64
|
+
it "loads an external web page", :aaa => 'ccc' do
|
65
|
+
book.open "http://www.google.com"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
"""
|
69
|
+
When I run `ckit tags`
|
70
|
+
Then the stdout from "ckit tags" should contain:
|
71
|
+
"""
|
72
|
+
....
|
73
|
+
Tags used in harness:
|
74
|
+
|
75
|
+
aaa:ccc
|
76
|
+
bbb:aaa
|
77
|
+
bbb:ddd
|
78
|
+
depth:shallow
|
79
|
+
|
80
|
+
|
81
|
+
Finished
|
82
|
+
"""
|
data/lib/chemistrykit/cli/cli.rb
CHANGED
@@ -27,21 +27,44 @@ module ChemistryKit
|
|
27
27
|
class CKitCLI < Thor
|
28
28
|
|
29
29
|
register(ChemistryKit::CLI::New, 'new', 'new [NAME]', 'Creates a new ChemistryKit project')
|
30
|
+
|
30
31
|
check_unknown_options!
|
31
32
|
default_task :help
|
32
33
|
|
33
34
|
desc 'generate SUBCOMMAND', 'generate <formula> or <beaker> [NAME]'
|
34
35
|
subcommand 'generate', Generate
|
35
36
|
|
37
|
+
desc 'tags', 'Lists all tags in use in the test harness.'
|
38
|
+
def tags
|
39
|
+
beakers = Dir.glob(File.join(Dir.getwd, 'beakers/*'))
|
40
|
+
RSpec.configure do |c|
|
41
|
+
c.add_setting :used_tags
|
42
|
+
c.before(:suite) { RSpec.configuration.used_tags = [] }
|
43
|
+
c.around(:each) do |example|
|
44
|
+
standard_keys = [:example_group, :example_group_block, :description_args, :caller, :execution_result]
|
45
|
+
example.metadata.each do |key, value|
|
46
|
+
tag = "#{key}:#{value}" unless standard_keys.include?(key)
|
47
|
+
RSpec.configuration.used_tags.push tag unless RSpec.configuration.used_tags.include?(tag) || tag.nil?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
c.after(:suite) do
|
51
|
+
puts "\nTags used in harness:\n\n"
|
52
|
+
puts RSpec.configuration.used_tags.sort
|
53
|
+
end
|
54
|
+
end
|
55
|
+
RSpec::Core::Runner.run(beakers)
|
56
|
+
end
|
57
|
+
|
36
58
|
desc 'brew', 'Run ChemistryKit'
|
37
59
|
method_option :params, type: :hash
|
38
|
-
method_option :tag,
|
60
|
+
method_option :tag, type: :array
|
39
61
|
method_option :config, default: 'config.yaml', aliases: '-c', desc: 'Supply alternative config file.'
|
40
62
|
# TODO there should be a facility to simply pass a path to this command
|
41
|
-
method_option :beakers, type: :array
|
63
|
+
method_option :beakers, aliases: '-a', type: :array
|
42
64
|
# This is set if the thread is being run in parallel so as not to trigger recursive concurency
|
43
65
|
method_option :parallel, default: false
|
44
|
-
method_option :results_file, default: false
|
66
|
+
method_option :results_file, aliases: '-r', default: false, desc: 'Specifiy the name of your results file.'
|
67
|
+
method_option :all, default: false, aliases: '-a', desc: 'Run every beaker.', type: :boolean
|
45
68
|
|
46
69
|
def brew
|
47
70
|
config = load_config options['config']
|
@@ -53,14 +76,35 @@ module ChemistryKit
|
|
53
76
|
config = override_configs options, config
|
54
77
|
|
55
78
|
load_page_objects
|
56
|
-
|
57
|
-
# configure rspec
|
58
|
-
rspec_config(config)
|
79
|
+
|
59
80
|
# get those beakers that should be executed
|
60
81
|
beakers = options['beakers'] ? options['beakers'] : Dir.glob(File.join(Dir.getwd, 'beakers/*'))
|
82
|
+
|
83
|
+
if options['beakers']
|
84
|
+
# if a beaker(s) defined use them
|
85
|
+
beakers = options['beakers']
|
86
|
+
# if tags are explicity defined, apply them to the selected beakers
|
87
|
+
setup_tags(options['tag'])
|
88
|
+
else
|
89
|
+
# beakers default to everything
|
90
|
+
beakers = Dir.glob(File.join(Dir.getwd, 'beakers/*'))
|
91
|
+
|
92
|
+
if options['tag']
|
93
|
+
|
94
|
+
# if tags are explicity defined, apply them to all beakers
|
95
|
+
setup_tags(options['tag'])
|
96
|
+
else
|
97
|
+
# else choose the default tag
|
98
|
+
setup_tags(['depth:shallow'])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# configure rspec
|
103
|
+
rspec_config(config)
|
104
|
+
|
61
105
|
# based on concurrency parameter run tests
|
62
106
|
if config.concurrency > 1 && ! options['parallel']
|
63
|
-
run_in_parallel beakers, config.concurrency
|
107
|
+
run_in_parallel beakers, config.concurrency, @tags
|
64
108
|
else
|
65
109
|
run_rspec beakers
|
66
110
|
end
|
@@ -93,9 +137,9 @@ module ChemistryKit
|
|
93
137
|
ChemistryKit::Configuration.initialize_with_yaml config_file
|
94
138
|
end
|
95
139
|
|
96
|
-
def setup_tags
|
140
|
+
def setup_tags(selected_tags)
|
97
141
|
@tags = {}
|
98
|
-
|
142
|
+
selected_tags.each do |tag|
|
99
143
|
filter_type = tag.start_with?('~') ? :exclusion_filter : :filter
|
100
144
|
|
101
145
|
name, value = tag.gsub(/^(~@|~|@)/, '').split(':')
|
@@ -105,7 +149,7 @@ module ChemistryKit
|
|
105
149
|
|
106
150
|
@tags[filter_type] ||= {}
|
107
151
|
@tags[filter_type][name] = value
|
108
|
-
end
|
152
|
+
end unless selected_tags.nil?
|
109
153
|
end
|
110
154
|
|
111
155
|
def rspec_config(config) # Some of these bits work and others don't
|
@@ -114,23 +158,17 @@ module ChemistryKit
|
|
114
158
|
end
|
115
159
|
RSpec.configure do |c|
|
116
160
|
c.treat_symbols_as_metadata_keys_with_true_values = true
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
# set the config available globaly
|
121
|
-
@config = config
|
122
|
-
# assign base url to env variable for formulas
|
123
|
-
ENV['BASE_URL'] = config.base_url
|
124
|
-
end
|
125
|
-
c.before(:each) do
|
126
|
-
@driver = SeleniumConnect.start
|
161
|
+
unless options[:all]
|
162
|
+
c.filter_run @tags[:filter] unless @tags[:filter].nil?
|
163
|
+
c.filter_run_excluding @tags[:exclusion_filter] unless @tags[:exclusion_filter].nil?
|
127
164
|
end
|
128
|
-
c.
|
129
|
-
@
|
130
|
-
|
131
|
-
c.after(:all) do
|
132
|
-
SeleniumConnect.finish
|
165
|
+
c.before(:all) do
|
166
|
+
@config = config # set the config available globaly
|
167
|
+
ENV['BASE_URL'] = config.base_url # assign base url to env variable for formulas
|
133
168
|
end
|
169
|
+
c.before(:each) { @driver = SeleniumConnect.start }
|
170
|
+
c.after(:each) { @driver.quit }
|
171
|
+
c.after(:all) { SeleniumConnect.finish }
|
134
172
|
c.order = 'random'
|
135
173
|
c.default_path = 'beakers'
|
136
174
|
c.pattern = '**/*_beaker.rb'
|
@@ -142,9 +180,10 @@ module ChemistryKit
|
|
142
180
|
end
|
143
181
|
end
|
144
182
|
|
145
|
-
def run_in_parallel(beakers, concurrency)
|
146
|
-
|
147
|
-
|
183
|
+
def run_in_parallel(beakers, concurrency, tags)
|
184
|
+
tag_string = tags.empty? ? nil : '--tag=' + tags[:filter].map { |k, v| "#{k}:#{v}" }.join(' ')
|
185
|
+
args = %w(--type rspec) + ['-n', concurrency.to_s] + ['-o', "#{tag_string} --beakers="] + beakers
|
186
|
+
ParallelTests::CLI.new.run(args)
|
148
187
|
end
|
149
188
|
|
150
189
|
def run_rspec(beakers)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chemistrykit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-07-
|
13
|
+
date: 2013-07-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -220,7 +220,7 @@ dependencies:
|
|
220
220
|
- - ~>
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 0.9.0
|
223
|
-
description:
|
223
|
+
description: Fixed bugs with tagging and concurrency
|
224
224
|
email:
|
225
225
|
- dave@arrgyle.com
|
226
226
|
- jason@arrgyle.com
|
@@ -255,6 +255,7 @@ files:
|
|
255
255
|
- features/new.feature
|
256
256
|
- features/step_definitions/steps.rb
|
257
257
|
- features/support/env.rb
|
258
|
+
- features/tags.feature
|
258
259
|
- lib/chemistrykit.rb
|
259
260
|
- lib/chemistrykit/catalyst.rb
|
260
261
|
- lib/chemistrykit/cli/beaker.rb
|
@@ -301,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
302
|
version: '0'
|
302
303
|
segments:
|
303
304
|
- 0
|
304
|
-
hash:
|
305
|
+
hash: -1364358405018714304
|
305
306
|
requirements: []
|
306
307
|
rubyforge_project:
|
307
308
|
rubygems_version: 1.8.25
|
@@ -321,6 +322,7 @@ test_files:
|
|
321
322
|
- features/new.feature
|
322
323
|
- features/step_definitions/steps.rb
|
323
324
|
- features/support/env.rb
|
325
|
+
- features/tags.feature
|
324
326
|
- spec/chemistrykit/catalyst_spec.rb
|
325
327
|
- spec/chemistrykit/cli/helpers/formula_loader_spec.rb
|
326
328
|
- spec/chemistrykit/configuration_spec.rb
|