chemistrykit 3.4.2 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ #3.5.0 (2013-07-15)
2
+ updated logging to store assets in a per beaker folder
3
+
4
+ - Bumped version to 3.5.0 to prepare for release.
5
+ - updated docs
6
+ - updated ckit to use latest sc with cleaner log storage and added a flag for the screenshot download
7
+
1
8
  #3.4.2 (2013-07-14)
2
9
  fixed typo
3
10
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #ChemistryKit 3.4.2 (2013-07-14)
1
+ #ChemistryKit 3.5.0 (2013-07-15)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/chemistrykit.png)](http://badge.fury.io/rb/chemistrykit) [![Build Status](https://travis-ci.org/arrgyle/chemistrykit.png?branch=develop)](https://travis-ci.org/jrobertfox/chef-broiler-platter) [![Code Climate](https://codeclimate.com/github/arrgyle/chemistrykit.png)](https://codeclimate.com/github/arrgyle/chemistrykit) [![Coverage Status](https://coveralls.io/repos/arrgyle/chemistrykit/badge.png?branch=develop)](https://coveralls.io/r/arrgyle/chemistrykit?branch=develop)
4
4
 
@@ -100,7 +100,7 @@ You can even nest them inside different describe/context blocks and they will ge
100
100
  ###Logs and CI Integration
101
101
  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.
102
102
 
103
- We also output an attachment message to stdout allowing you to use [this plugin](https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Attachments+Plugin) for integrating the files with jenkins!
103
+ Assets generated by selenium (logs, screenshots, etc.) are stored in a subfolder with a name matching the describe block in your beaker, slugifyed like: `my_beaker_name`. This is to provide some organization but also allow the integration with jenkins using [this plugin](https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Attachments+Plugin).
104
104
 
105
105
  ##Configuration
106
106
  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:
@@ -118,6 +118,8 @@ ChemistryKit is configured by default with a `config.yaml` file that is created
118
118
  `selenium_connect:` Options in this node override the defaults for the [Selenium Connect](https://github.com/arrgyle/selenium-connect) gem.
119
119
  ##Command Line Usage
120
120
 
121
+ `screenshot_on_fail` By default false, set to true to download a screenshot of the failure (supported by sauce labs for now.)
122
+
121
123
  ###new
122
124
  Creates a new ChemistryKit project.
123
125
 
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.4.2'
5
+ s.version = '3.5.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 = 'fixed typo'
11
+ s.description = 'updated logging to store assets in a per beaker folder'
12
12
  s.license = 'MIT'
13
13
 
14
14
  s.files = `git ls-files`.split($/)
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency 'yarjuf', '~> 1.0.5'
25
25
  s.add_dependency 'selenium-webdriver', '~> 2.29.0'
26
26
  s.add_dependency 'rest-client', '~> 1.6.7'
27
- s.add_dependency 'selenium-connect', '~> 3.1.2'
27
+ s.add_dependency 'selenium-connect', '~> 3.2.0'
28
28
  s.add_dependency 'parallel_tests', '~> 0.15.0'
29
29
  s.add_dependency 'parallel', '~> 0.7.0'
30
30
 
@@ -40,8 +40,8 @@ Feature: Brewing a ChemistryKit project
40
40
  When I run `ckit brew`
41
41
  Then the stdout should contain "1 example, 0 failures"
42
42
  And the following files should exist:
43
- | evidence/results_junit.xml |
44
- | evidence/server.log |
43
+ | evidence/results_junit.xml |
44
+ | evidence/bookie/server.log |
45
45
 
46
46
  Scenario: Saucelabs
47
47
  Given a file named "config.yaml" with:
@@ -98,10 +98,10 @@ Feature: Brewing a ChemistryKit project
98
98
  """
99
99
  When I run `ckit brew --all`
100
100
  Then the stdout should contain "2 examples, 0 failures"
101
-
102
101
  Scenario: Saucelabs
103
102
  Given a file named "config.yaml" with:
104
103
  """
104
+ screenshot_on_fail: true
105
105
  selenium_connect:
106
106
  log: 'evidence'
107
107
  host: 'saucelabs'
@@ -114,7 +114,7 @@ Feature: Brewing a ChemistryKit project
114
114
  """
115
115
  And a file named "beakers/failure.rb" with:
116
116
  """
117
- describe "Failing", :depth => 'shallow' do
117
+ describe "Failing Beaker", :depth => 'shallow' do
118
118
  it "loads an external web page" do
119
119
  @driver.get "http://www.google.com"
120
120
  @driver.title.should_not include("Google")
@@ -123,7 +123,6 @@ Feature: Brewing a ChemistryKit project
123
123
  """
124
124
  When I run `ckit brew --beakers=beakers/failure.rb`
125
125
  Then the stdout should contain "1 example, 1 failure"
126
- And the stdout should contain "[[ATTACHEMENT|/Users/jfox/development/arrgyle/chemistrykit/build/tmp/booker/evidence/"
127
- And there should be "1" "failed image" log files in "evidence"
128
- And there should be "1" "report" log files in "evidence"
129
- And there should be "1" "sauce log" log files in "evidence"
126
+ And there should be "1" "failed image" log files in "evidence/failing_beaker"
127
+ And there should be "1" "report" log files in "evidence/failing_beaker"
128
+ And there should be "1" "sauce log" log files in "evidence/failing_beaker"
@@ -97,5 +97,4 @@ Feature: Support for concurency
97
97
  Then the stdout should not contain "All examples were filtered out"
98
98
  And the stdout should not contain "0 examples, 0 failures"
99
99
  And there should be "4" unique results files in the "evidence" directory
100
- And there should be "5" "report" log files in "evidence"
101
- And there should be "5" "sauce log" log files in "evidence"
100
+ And there should be "2" "report" log files in "evidence/cheese"
@@ -84,7 +84,8 @@ Feature: Log handling
84
84
  Then the stdout should contain "2 examples, 0 failures"
85
85
  And the following files should exist:
86
86
  | my_evidence/results_junit.xml |
87
- | my_evidence/server.log |
87
+ | my_evidence/first/server.log |
88
+ | my_evidence/second/server.log |
88
89
 
89
90
  Scenario: I can runtime override the results output file name
90
91
  When I run `ckit brew --results_file results_junit_01.xml`
@@ -26,7 +26,7 @@ Feature: Support for multiple configuration files
26
26
  When I run `ckit brew`
27
27
  Then the stdout should contain "1 example, 0 failures"
28
28
  And the following files should exist:
29
- | evidence_config/server.log |
29
+ | evidence_config/cheese/server.log |
30
30
 
31
31
  Scenario: I can specifiy an alternative configuration with --config
32
32
  Given a directory named "evidence_alternate"
@@ -39,7 +39,7 @@ Feature: Support for multiple configuration files
39
39
  When I run `ckit brew --config alternate.yaml`
40
40
  Then the stdout should contain "1 example, 0 failures"
41
41
  And the following files should exist:
42
- | evidence_alternate/server.log |
42
+ | evidence_alternate/cheese/server.log |
43
43
 
44
44
  Scenario: I can specifiy an alternative configuration with -c
45
45
  Given a directory named "evidence_alternate"
@@ -52,7 +52,7 @@ Feature: Support for multiple configuration files
52
52
  When I run `ckit brew -c alternate.yaml`
53
53
  Then the stdout should contain "1 example, 0 failures"
54
54
  And the following files should exist:
55
- | evidence_alternate/server.log |
55
+ | evidence_alternate/cheese/server.log |
56
56
 
57
57
  Scenario: I can specifiy an alternative configuration with --config with concurrency
58
58
  Given a directory named "evidence_alternate"
@@ -68,4 +68,4 @@ Feature: Support for multiple configuration files
68
68
  Then the stdout should contain "1 example, 0 failures"
69
69
  And there should be "1" unique results files in the "evidence_alternate" directory
70
70
  And the following files should exist:
71
- | evidence_alternate/server.log |
71
+ | evidence_alternate/cheese/server.log |
@@ -26,11 +26,11 @@ Then(/^there should be "(.*?)" "(.*?)" log files in "(.*?)"$/) do |number, type,
26
26
  files.each do |file|
27
27
  case type
28
28
  when 'failed image'
29
- count += 1 if file =~ /failed_.+\.png/
29
+ count += 1 if file =~ /.+_failshot_.+\.png/
30
30
  when 'report'
31
- count += 1 if file =~ /report_.+\.log/
31
+ count += 1 if file =~ /.+_saucejob_.+\.log/
32
32
  when 'sauce log'
33
- count += 1 if file =~ /sauce_job_.+\.log/
33
+ count += 1 if file =~ /.+_serverlog_.+\.log/
34
34
  end
35
35
  end
36
36
  count.should == number.to_i
@@ -163,33 +163,30 @@ module ChemistryKit
163
163
  c.before(:all) do
164
164
  @config = config # set the config available globaly
165
165
  ENV['BASE_URL'] = config.base_url # assign base url to env variable for formulas
166
- sc_config = SeleniumConnect::Configuration.new
167
- sc_config.populate_with_hash config.selenium_connect
168
- @sc = SeleniumConnect.start sc_config # fire up a connection to SC
169
166
  end
170
167
  c.around(:each) do |example|
168
+ # create the beaker name from the example data
169
+ beaker_name = example.metadata[:example_group][:description_args].first.downcase.strip.gsub(' ', '_').gsub(/[^\w-]/, '')
170
+ # override log path with be beaker sub path
171
+ sc_config = @config.selenium_connect.dup
172
+ sc_config[:log] += "/#{beaker_name}"
173
+ sub_evidence_path = File.join(Dir.getwd, sc_config[:log])
174
+ Dir.mkdir sub_evidence_path unless File.exists?(sub_evidence_path)
175
+
176
+ # configure and start sc
177
+ configuration = SeleniumConnect::Configuration.new sc_config
178
+ @sc = SeleniumConnect.start configuration
171
179
  @job = @sc.create_job # create a new job
172
180
  @driver = @job.start name: example.metadata[:full_description]
173
181
  example.run
174
182
  end
175
183
  c.after(:each) do
176
184
  if example.exception != nil
177
- report = @job.finish failed: true, failshot: true
185
+ @job.finish failed: true, failshot: @config.screenshot_on_fail
178
186
  else
179
- report = @job.finish passed: true
187
+ @job.finish passed: true
180
188
  end
181
189
  @sc.finish
182
-
183
- # TODO absctract this out into some report handler class
184
- data = report.data
185
- unless data.empty?
186
- report_file = File.join(Dir.getwd, config.log.path, "report_#{data[:sauce_data][:id]}.log")
187
- File.open(report_file, 'w') { |file| file.write(data.to_s) }
188
- puts "\n[[ATTACHMENT|#{report_file}]]\n"
189
- end
190
- puts "\n[[ATTACHMENT|#{File.join(Dir.getwd, config.log.path, data[:failshot])}]]\n" if data[:failshot]
191
- puts "\n[[ATTACHMENT|#{File.join(Dir.getwd, config.log.path, data[:server_log])}]]\n" if data[:server_log]
192
- ###
193
190
  end
194
191
  c.order = 'random'
195
192
  c.default_path = 'beakers'
@@ -8,7 +8,8 @@ module ChemistryKit
8
8
  class Configuration
9
9
 
10
10
  attr_accessor :base_url,
11
- :concurrency
11
+ :concurrency,
12
+ :screenshot_on_fail
12
13
 
13
14
  attr_reader :log
14
15
 
@@ -18,6 +19,7 @@ module ChemistryKit
18
19
  # set defaults
19
20
  @concurrency = 1
20
21
  @selenium_connect = {}
22
+ @screenshot_on_fail = false
21
23
  @log = OpenStruct.new
22
24
  @log.path = 'evidence'
23
25
  @log.results_file = 'results_junit.xml'
@@ -2,6 +2,7 @@
2
2
 
3
3
  base_url: http://google.com
4
4
  concurrency: 1
5
+ screenshot_on_fail:
5
6
  log:
6
7
  path: 'evidence'
7
8
  results_file: 'results_junit.xml'
@@ -24,6 +24,7 @@ describe ChemistryKit::Configuration do
24
24
  end
25
25
 
26
26
  def validate_config(config)
27
+ config.screenshot_on_fail.should eq false
27
28
  config.concurrency.should eq VALID_CONCURRENCY
28
29
  config.base_url.should eq VALID_BASE_URL
29
30
  config.log.path.should eq VALID_LOG_PATH
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.2
4
+ version: 3.5.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-14 00:00:00.000000000 Z
13
+ date: 2013-07-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -99,7 +99,7 @@ dependencies:
99
99
  requirements:
100
100
  - - ~>
101
101
  - !ruby/object:Gem::Version
102
- version: 3.1.2
102
+ version: 3.2.0
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ dependencies:
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: 3.1.2
110
+ version: 3.2.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: parallel_tests
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -252,7 +252,7 @@ dependencies:
252
252
  - - ~>
253
253
  - !ruby/object:Gem::Version
254
254
  version: 0.6.7
255
- description: fixed typo
255
+ description: updated logging to store assets in a per beaker folder
256
256
  email:
257
257
  - dave@arrgyle.com
258
258
  - jason@arrgyle.com
@@ -337,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
337
  version: '0'
338
338
  segments:
339
339
  - 0
340
- hash: -2534848085378017120
340
+ hash: -2897425832114574927
341
341
  requirements: []
342
342
  rubyforge_project:
343
343
  rubygems_version: 1.8.25