chemistrykit 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rubocop.yml +5 -0
- data/.ruby-version +1 -1
- data/.travis.yml +0 -4
- data/CHANGELOG.md +29 -0
- data/Rakefile +66 -53
- data/bin/ckit +3 -1
- data/chemistrykit.gemspec +8 -3
- data/features/brew.feature +18 -17
- data/features/catalyst.feature +4 -4
- data/features/concurrency.feature +61 -0
- data/features/exit_status.feature +5 -5
- data/features/global-config.feature +26 -0
- data/features/load_page_objects.feature +4 -4
- data/features/multi-config.feature +10 -10
- data/features/step_definitions/steps.rb +5 -3
- data/features/support/env.rb +4 -2
- data/lib/chemistrykit.rb +2 -0
- data/lib/chemistrykit/catalyst.rb +5 -4
- data/lib/chemistrykit/cli/beaker.rb +3 -0
- data/lib/chemistrykit/cli/cli.rb +54 -28
- data/lib/chemistrykit/cli/formula.rb +5 -2
- data/lib/chemistrykit/cli/helpers/formula_loader.rb +32 -19
- data/lib/chemistrykit/cli/new.rb +5 -2
- data/lib/chemistrykit/configuration.rb +54 -0
- data/lib/chemistrykit/formula/base.rb +6 -3
- data/lib/chemistrykit/parallel_tests_mods.rb +55 -0
- data/lib/chemistrykit/shared_context.rb +13 -4
- data/lib/templates/chemistrykit/config.yaml.tt +22 -17
- data/lib/templates/chemistrykit/formulas/lib/formula.rb +5 -2
- data/spec/chemistrykit/catalyst_spec.rb +5 -9
- data/spec/chemistrykit/cli/helpers/formula_loader_spec.rb +15 -13
- data/spec/chemistrykit/configuration_spec.rb +56 -0
- data/spec/chemistrykit/formula/base_spec.rb +4 -2
- data/spec/spec_helper.rb +4 -1
- data/spec/support/config.yaml +7 -0
- metadata +65 -6
data/.rubocop.yml
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-1.9.3
|
1
|
+
ruby-1.9.3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
#3.0.0 (2013-07-04)
|
2
|
+
Now with concurrent tests
|
3
|
+
|
4
|
+
- Bumped version to 3.0.0 to prepare for release.
|
5
|
+
- included message into changelog update and added a test for specific concurrency feature
|
6
|
+
- integrated config driven concurrency, cleaned up some tests
|
7
|
+
- abstracted out config loading into brew
|
8
|
+
- learning how to spell concurrency correctly
|
9
|
+
- fixed a minor typo in a feature and added a todo comment
|
10
|
+
- updated feature files to have correct directory, added a test for concurency
|
11
|
+
- upgraded the global config into the shared context
|
12
|
+
- updated all tests to match new configuration format
|
13
|
+
- added back updated configuration object
|
14
|
+
- removed local references to selenium server and updated tests accordingly
|
15
|
+
- updated to latest build of selenium connect, fixed a small bug in a feature file, and updated the rakefile to handle find tags correctly
|
16
|
+
- Code quality fixes
|
17
|
+
- Wired up --processes to adjust number of processes when running --parallel, defaulting the number to 5
|
18
|
+
- Updated comment
|
19
|
+
- Updated sauce brew scenario to use our sauce account
|
20
|
+
- Test group execution working
|
21
|
+
- Renamed parallel to parallel_tests_mods for better explicitness. Got ckit brew running with parallel_tests (WOOT!). Now just need to figure out how to execute tests within a group for each thread rather than all tests in each thread.
|
22
|
+
- removed branch restriction on travis so all feature branches would be tested
|
23
|
+
- Fixed all code quality issues, added custom options file to tweek method length and line length cops, updated build system
|
24
|
+
- added rubocop to the build process
|
25
|
+
- Added a monkey patch for parallel_tests' RSpec runner to override its defaults with ours and wired it up in the parallel execution hook. It runs but gives an argument error from ckit. Also, took a first crack at setting the base_url via config.yaml and the shared_context
|
26
|
+
- Added parallel_tests and parallel to repo. Wired up a command argument for ckit brew (--parallel) to execute the wip progess concurrency method.
|
27
|
+
- Downgraded the required ruby version to just 1.9.3
|
28
|
+
- one small edit because of a bug with git flow #62
|
29
|
+
|
1
30
|
#2.1.0 (2013-06-28)
|
2
31
|
- Updated documentation for #62 release process.
|
3
32
|
- Bumped version to 2.1.0 to prepare for release.
|
data/Rakefile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# Encoding: utf-8
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'cucumber'
|
5
|
+
require 'cucumber/rake/task'
|
4
6
|
require 'rspec/core/rake_task'
|
5
7
|
|
6
|
-
task :
|
8
|
+
task default: :build_ci
|
7
9
|
|
8
10
|
desc 'Runs standard build activities.'
|
9
|
-
task :
|
11
|
+
task build: [:clean, :prepare, :rubocop, :spec, :cucumber]
|
10
12
|
|
11
13
|
desc 'Runs standard build activities for ci server.'
|
12
|
-
task :
|
14
|
+
task build_ci: [:clean, :prepare, :rubocop, :spec]
|
13
15
|
|
14
16
|
desc 'Removes the build directory.'
|
15
17
|
task :clean do
|
@@ -24,44 +26,49 @@ RSpec::Core::RakeTask.new(:spec)
|
|
24
26
|
|
25
27
|
Cucumber::Rake::Task.new(:cucumber)
|
26
28
|
|
29
|
+
desc 'Runs code quality check'
|
30
|
+
task :rubocop do
|
31
|
+
sh 'rubocop'
|
32
|
+
end
|
27
33
|
|
28
|
-
#TODO This could
|
34
|
+
# TODO This could probably be more cleanly automated
|
29
35
|
desc 'Start a release (Requires Git Flow)'
|
30
36
|
task :release_start, :version do |t, args|
|
31
37
|
version = args['version']
|
32
38
|
|
33
|
-
#make sure we have the latest stuff
|
34
|
-
system
|
39
|
+
# make sure we have the latest stuff
|
40
|
+
system 'git fetch --all'
|
35
41
|
|
36
|
-
#first make sure master is checked out and up to date
|
37
|
-
system
|
38
|
-
system
|
42
|
+
# first make sure master is checked out and up to date
|
43
|
+
system 'git checkout master'
|
44
|
+
system 'git pull --no-edit origin master'
|
39
45
|
|
40
|
-
#then make sure develop is up to date
|
41
|
-
system
|
42
|
-
system
|
46
|
+
# then make sure develop is up to date
|
47
|
+
system 'git checkout develop'
|
48
|
+
system 'git pull --no-edit origin develop'
|
43
49
|
|
44
|
-
#next assure all the tests run
|
50
|
+
# next assure all the tests run
|
45
51
|
task(:build).invoke
|
46
52
|
|
47
|
-
#start the release process
|
53
|
+
# start the release process
|
48
54
|
system "git flow release start #{version}"
|
49
55
|
|
50
|
-
#update the version number in the .gemspec file
|
56
|
+
# update the version number in the .gemspec file
|
51
57
|
gemspec = File.join(Dir.getwd, 'chemistrykit.gemspec')
|
52
|
-
updated = File.read(gemspec).gsub(
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
58
|
+
updated = File.read(gemspec).gsub(
|
59
|
+
/s.version(\s+)=(\s?["|']).+(["|'])/,
|
60
|
+
"s.version\\1=\\2#{version}\\3"
|
61
|
+
)
|
62
|
+
File.open(gemspec, 'w') { |f| f.write(updated) }
|
63
|
+
|
64
|
+
# commit the version bump
|
65
|
+
system 'git add chemistrykit.gemspec'
|
59
66
|
system "git commit -m 'Bumped version to #{version} to prepare for release.'"
|
60
67
|
|
61
68
|
puts "You've started release #{version}, make any last minute updates now.\n"
|
62
69
|
end
|
63
70
|
|
64
|
-
#TODO This could probablly be more cleanly automated
|
71
|
+
# TODO This could probablly be more cleanly automated
|
65
72
|
desc 'Finish a release (Requires Git Flow and Gem Deploy Permissions'
|
66
73
|
task :release_finish, :update_message do |t, args|
|
67
74
|
message = args['update_message']
|
@@ -69,51 +76,57 @@ task :release_finish, :update_message do |t, args|
|
|
69
76
|
changelog = File.join(Dir.getwd, 'CHANGELOG.md')
|
70
77
|
version = File.read(gemspec).match(/s.version\s+=\s?["|'](.+)["|']/)[1]
|
71
78
|
|
72
|
-
###Changelog
|
73
|
-
#get the latest tag
|
79
|
+
### Changelog
|
80
|
+
# get the latest tag
|
81
|
+
system 'git checkout master'
|
74
82
|
last_tag = `git describe --abbrev=0`
|
75
|
-
|
83
|
+
system "git checkout release/#{version}"
|
84
|
+
|
85
|
+
# get the commit hash since the last that version was merged to develop
|
76
86
|
hash = `git log --grep="Merge branch 'release/#{last_tag.chomp}' into develop" --format="%H"`
|
77
|
-
#get all the commits since them less merges
|
87
|
+
# get all the commits since them less merges
|
78
88
|
log = `git log --format="- %s" --no-merges #{hash.chomp}..HEAD`
|
79
89
|
|
80
90
|
changelog_contents = File.read(changelog)
|
81
|
-
date = Time.new.strftime(
|
82
|
-
#create the new heading
|
83
|
-
updated_changelog = "##{version} (#{date})\n" + log + "\n" + changelog_contents
|
84
|
-
#update the contents
|
85
|
-
File.open(changelog, 'w'){ |f| f.write(updated_changelog) }
|
91
|
+
date = Time.new.strftime('%Y-%m-%d')
|
92
|
+
# create the new heading
|
93
|
+
updated_changelog = "##{version} (#{date})\n" + message + "\n\n" + log + "\n" + changelog_contents
|
94
|
+
# update the contents
|
95
|
+
File.open(changelog, 'w') { |f| f.write(updated_changelog) }
|
86
96
|
puts "Updated change log for version #{version}\n"
|
87
97
|
|
88
|
-
###Update the gemspec with the message
|
89
|
-
updated_gemspec = File.read(gemspec).gsub(
|
90
|
-
|
91
|
-
|
92
|
-
|
98
|
+
### Update the gemspec with the message
|
99
|
+
updated_gemspec = File.read(gemspec).gsub(
|
100
|
+
/s.description(\s+)=(\s?["|']).+(["|'])/,
|
101
|
+
"s.description\\1=\\2#{message}\\3"
|
102
|
+
)
|
103
|
+
File.open(gemspec, 'w') { |f| f.write(updated_gemspec) }
|
93
104
|
|
94
|
-
#Commit the updated change log and gemspec
|
105
|
+
# Commit the updated change log and gemspec
|
95
106
|
system "git commit -am 'Updated CHANGELOG.md and gemspec for #{version} release.'"
|
96
107
|
|
97
|
-
#build the gem
|
98
|
-
system
|
108
|
+
# build the gem
|
109
|
+
system 'gem build chemistrykit.gemspec'
|
99
110
|
|
100
|
-
#push the gem
|
111
|
+
# push the gem
|
101
112
|
system "gem push chemistrykit-#{version}.gem"
|
102
113
|
|
103
|
-
#remove the gem file
|
114
|
+
# remove the gem file
|
104
115
|
system "rm chemistrykit-#{version}.gem"
|
105
116
|
|
106
|
-
#finish the release
|
107
|
-
|
117
|
+
# finish the release
|
118
|
+
# TODO there is a bug with git flow, and you still need to deal with merge
|
119
|
+
# messages, might just do this with git directly
|
120
|
+
system "git flow release finish -m'#{version}' #{version}"
|
108
121
|
|
109
|
-
#push develop
|
110
|
-
system
|
122
|
+
# push develop
|
123
|
+
system 'git push origin develop'
|
111
124
|
|
112
|
-
#push master
|
113
|
-
system
|
125
|
+
# push master
|
126
|
+
system 'git push origin master'
|
114
127
|
|
115
|
-
#push tags
|
116
|
-
system
|
128
|
+
# push tags
|
129
|
+
system 'git push --tags'
|
117
130
|
|
118
131
|
puts "Rock and roll, you just released ChemistryKit #{version}!\n"
|
119
132
|
end
|
data/bin/ckit
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# Encoding: utf-8
|
3
|
+
|
2
4
|
require 'chemistrykit'
|
3
5
|
|
4
6
|
# Had difficulties getting Thor to return a proper exit status on failure
|
5
7
|
# Will need to revisit
|
6
8
|
ckit_result = ChemistryKit::CLI::CKitCLI.start
|
7
|
-
ckit_result.kind_of?(Integer)? exit(ckit_result): exit(0)
|
9
|
+
ckit_result.kind_of?(Integer) ? exit(ckit_result) : exit(0)
|
data/chemistrykit.gemspec
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = "chemistrykit"
|
3
|
-
s.version = "
|
5
|
+
s.version = "3.0.0"
|
4
6
|
s.platform = Gem::Platform::RUBY
|
5
7
|
s.authors = ["Dave Haeffner", "Jason Fox"]
|
6
8
|
s.email = ["dave@arrgyle.com", "jason@arrgyle.com"]
|
7
9
|
s.homepage = "https://github.com/arrgyle/chemistrykit"
|
8
10
|
s.summary = "A simple and opinionated web testing framework for Selenium that follows convention over configuration."
|
9
|
-
s.description = "
|
11
|
+
s.description = "Now with concurrent tests"
|
10
12
|
s.license = 'MIT'
|
11
13
|
|
12
14
|
s.files = `git ls-files`.split($/)
|
@@ -22,10 +24,13 @@ Gem::Specification.new do |s|
|
|
22
24
|
s.add_dependency "selenium-webdriver", "~> 2.29.0"
|
23
25
|
s.add_dependency "ci_reporter", "~> 1.8.3"
|
24
26
|
s.add_dependency "rest-client", "~> 1.6.7"
|
25
|
-
s.add_dependency "selenium-connect", "~> 2.
|
27
|
+
s.add_dependency "selenium-connect", "~> 2.1.1"
|
28
|
+
s.add_dependency "parallel_tests", "~> 0.15.0"
|
29
|
+
s.add_dependency "parallel", "~> 0.7.0"
|
26
30
|
|
27
31
|
s.add_development_dependency "rspec", "~> 2.12.0"
|
28
32
|
s.add_development_dependency "aruba", "~> 0.5.1"
|
29
33
|
s.add_development_dependency "cucumber", "~> 1.2.1"
|
30
34
|
s.add_development_dependency "rake", "~> 10.0.3"
|
35
|
+
s.add_development_dependency "rubocop", "~> 0.9.0"
|
31
36
|
end
|
data/features/brew.feature
CHANGED
@@ -19,7 +19,7 @@ Feature: Brewing a ChemistryKit project
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
"""
|
22
|
-
And a file named "
|
22
|
+
And a file named "beakers/bookie_beaker.rb" with:
|
23
23
|
"""
|
24
24
|
describe "Bookie", :depth => 'shallow' do
|
25
25
|
let(:book) { Formulas::Bookie.new(@driver) }
|
@@ -33,9 +33,9 @@ Feature: Brewing a ChemistryKit project
|
|
33
33
|
Scenario: Localhost
|
34
34
|
Given a file named "config.yaml" with:
|
35
35
|
"""
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
selenium_connect:
|
37
|
+
log: 'evidence'
|
38
|
+
host: 'localhost'
|
39
39
|
"""
|
40
40
|
When I run `ckit brew`
|
41
41
|
Then the stdout should contain "1 example, 0 failures"
|
@@ -47,14 +47,15 @@ Feature: Brewing a ChemistryKit project
|
|
47
47
|
Scenario: Saucelabs
|
48
48
|
Given a file named "config.yaml" with:
|
49
49
|
"""
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
selenium_connect:
|
51
|
+
log: 'evidence'
|
52
|
+
host: 'saucelabs'
|
53
|
+
browser: 'iexplore'
|
54
|
+
os: 'windows 2003'
|
55
|
+
sauce_username: 'testing_arrgyle'
|
56
|
+
sauce_api_key: 'ab7a6e17-16df-42d2-9ef6-c8d2539cc38a'
|
57
|
+
browser_version: '8'
|
58
|
+
description: 'ckit feature check'
|
58
59
|
"""
|
59
60
|
When I run `ckit brew`
|
60
61
|
Then the stdout should contain "1 example, 0 failures"
|
@@ -62,11 +63,11 @@ Feature: Brewing a ChemistryKit project
|
|
62
63
|
Scenario: Brew a single beaker
|
63
64
|
Given a file named "config.yaml" with:
|
64
65
|
"""
|
65
|
-
|
66
|
-
|
67
|
-
|
66
|
+
selenium_connect:
|
67
|
+
log: 'evidence'
|
68
|
+
host: 'localhost'
|
68
69
|
"""
|
69
|
-
And a file named "
|
70
|
+
And a file named "beakers/other_beaker.rb" with:
|
70
71
|
"""
|
71
72
|
describe "Other", :depth => 'shallow' do
|
72
73
|
let(:book) { Formulas::Bookie.new(@driver) }
|
@@ -76,6 +77,6 @@ Feature: Brewing a ChemistryKit project
|
|
76
77
|
end
|
77
78
|
end
|
78
79
|
"""
|
79
|
-
When I run `ckit brew --
|
80
|
+
When I run `ckit brew --beakers=beakers/other_beaker.rb`
|
80
81
|
Then the stdout should contain "1 example, 0 failures"
|
81
82
|
|
data/features/catalyst.feature
CHANGED
@@ -64,7 +64,7 @@ Catalyst: n. A pocket of data (consumed from a CSV file) used to drive a test th
|
|
64
64
|
end
|
65
65
|
"""
|
66
66
|
|
67
|
-
And a file named "
|
67
|
+
And a file named "beakers/google_beaker.rb" with:
|
68
68
|
"""
|
69
69
|
describe "Google", :depth => 'shallow' do
|
70
70
|
let(:google) { Formulas::Google.new(@driver) }
|
@@ -80,9 +80,9 @@ Catalyst: n. A pocket of data (consumed from a CSV file) used to drive a test th
|
|
80
80
|
|
81
81
|
And a file named "config.yaml" with:
|
82
82
|
"""
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
selenium_connect:
|
84
|
+
log: 'evidence'
|
85
|
+
host: 'localhost'
|
86
86
|
"""
|
87
87
|
When I run `ckit brew`
|
88
88
|
Then the stdout should contain "1 example, 0 failures"
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Feature: Support for concurency
|
2
|
+
In order to run the tests quickly
|
3
|
+
As a chemistry kit harness developer
|
4
|
+
I want to run them in parallel
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I run `ckit new concurrency-test`
|
8
|
+
And I cd to "concurrency-test"
|
9
|
+
And a file named "beakers/first_beaker.rb" with:
|
10
|
+
"""
|
11
|
+
describe "Cheese", :depth => 'shallow' do
|
12
|
+
it "loads an external web page" do
|
13
|
+
@driver.get "http://www.google.com"
|
14
|
+
@driver.title.should include("Google")
|
15
|
+
end
|
16
|
+
it "loads an external web page" do
|
17
|
+
@driver.get "http://www.google.com"
|
18
|
+
@driver.title.should include("Google")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
"""
|
22
|
+
And a file named "beakers/second_beaker.rb" with:
|
23
|
+
"""
|
24
|
+
describe "Cheese 2", :depth => 'shallow' do
|
25
|
+
it "loads an external web page" do
|
26
|
+
@driver.get "http://www.google.com"
|
27
|
+
@driver.title.should include("Google")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
"""
|
31
|
+
Scenario: I can run the tests in parallel
|
32
|
+
When I overwrite config.yaml with:
|
33
|
+
"""
|
34
|
+
concurrency: 4
|
35
|
+
selenium_connect:
|
36
|
+
log: 'evidence'
|
37
|
+
host: 'saucelabs'
|
38
|
+
browser: 'firefox'
|
39
|
+
sauce_username: 'testing_arrgyle'
|
40
|
+
sauce_api_key: 'ab7a6e17-16df-42d2-9ef6-c8d2539cc38a'
|
41
|
+
description: 'concurrency check'
|
42
|
+
"""
|
43
|
+
When I run `ckit brew`
|
44
|
+
Then the stdout should contain "4 processes for 2 beakers"
|
45
|
+
And the stdout should contain "3 examples, 0 failures"
|
46
|
+
|
47
|
+
Scenario: I can run a specific beaker in parallel
|
48
|
+
When I overwrite config.yaml with:
|
49
|
+
"""
|
50
|
+
concurrency: 4
|
51
|
+
selenium_connect:
|
52
|
+
log: 'evidence'
|
53
|
+
host: 'saucelabs'
|
54
|
+
browser: 'firefox'
|
55
|
+
sauce_username: 'testing_arrgyle'
|
56
|
+
sauce_api_key: 'ab7a6e17-16df-42d2-9ef6-c8d2539cc38a'
|
57
|
+
description: 'concurrency check'
|
58
|
+
"""
|
59
|
+
When I run `ckit brew --beakers=beakers/first_beaker.rb`
|
60
|
+
Then the stdout should contain "4 processes for 1 beakers"
|
61
|
+
And the stdout should contain "2 examples, 0 failures"
|
@@ -5,13 +5,13 @@ Feature: Exit Status
|
|
5
5
|
And I cd to "cheese"
|
6
6
|
And a file named "config.yaml" with:
|
7
7
|
"""
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
selenium_connect:
|
9
|
+
log: 'evidence'
|
10
|
+
host: 'localhost'
|
11
11
|
"""
|
12
12
|
|
13
13
|
Scenario: Passing
|
14
|
-
And a file named "
|
14
|
+
And a file named "beakers/test_beaker.rb" with:
|
15
15
|
"""
|
16
16
|
describe "Cheese", :depth => 'shallow' do
|
17
17
|
it "loads an external web page" do
|
@@ -24,7 +24,7 @@ Feature: Exit Status
|
|
24
24
|
Then the exit code should be 0
|
25
25
|
|
26
26
|
Scenario: Failing
|
27
|
-
And a file named "
|
27
|
+
And a file named "beakers/test_beaker.rb" with:
|
28
28
|
"""
|
29
29
|
describe "Cheese", :depth => 'shallow' do
|
30
30
|
it "loads an external web page" do
|