parallelized_specs 0.4.65 → 0.4.66

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ begin
12
12
  gem.email = "jake@instructure.com"
13
13
  gem.homepage = "http://github.com/jakesorce/#{gem.name}"
14
14
  gem.authors = "Jake Sorce, Bryan Madsen, Shawn Meredith"
15
- gem.version = "0.4.65"
15
+ gem.version = "0.4.66"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -385,7 +385,7 @@ class ParallelizedSpecs
385
385
  puts "INFO: #{spec} will be ran and marked as a success if it passes"
386
386
  @examples = 0
387
387
  @failures = 0
388
- result = %x[bundle exec rake spec #{spec}]
388
+ result = %x[export DISPLAY=:2.0 firefox && bundle exec rake spec #{spec}]
389
389
  parse_result(result)
390
390
  result
391
391
  end
@@ -11,6 +11,7 @@ ActiveRecord::Base.establish_connection(
11
11
  :password => 'youtpass'
12
12
  )
13
13
 
14
+
14
15
  class SeleniumTrend < ActiveRecord::Base
15
16
  ActiveRecord::Migration.class_eval do
16
17
  unless SeleniumTrend.table_exists?
@@ -23,7 +24,9 @@ class SeleniumTrend < ActiveRecord::Base
23
24
  t.string :nested_spec_name
24
25
  t.string :trace
25
26
  t.string :full_path
26
- t.date :failure_date
27
+ t.string :time
28
+ t.string :status
29
+ t.date :date
27
30
  end
28
31
  end
29
32
  end
@@ -34,20 +37,21 @@ def store_failure_data
34
37
  data = "#{dir}/tmp/parallel_log/trends.log"
35
38
  File.open("#{data}", 'r') do |f|
36
39
  f.each_line do |line|
37
- values = line.split("*").to_a
38
-
39
40
  if values != nil
41
+ values = line.split("*").to_a
40
42
  spec_line_failure = values[0]
41
43
  spec_name = values[1]
42
- nested_spec_name = values[2]
43
- trace = values[3]
44
- full_path = values[4]
45
- failure_date = values[5]
46
- hudson_build = values[6]
47
- hudson_project = values[7]
48
- hudson_url = values[8]
44
+ date = values[2]
45
+ status = values[3]
46
+ time = values[4]
47
+ nested_spec_name = values[5]
48
+ trace = values[6]
49
+ full_path = values[7]
50
+ hudson_build = values[9]
51
+ hudson_project = values[10]
52
+ hudson_url = values[11]
49
53
 
50
- SeleniumTrend.create!(:spec_line_failure => spec_line_failure, :spec_name => spec_name, :nested_spec_name => nested_spec_name, :trace => trace, :full_path => full_path, :failure_date => failure_date, :hudson_build => hudson_build, :hudson_project => hudson_project, :hudson_url => hudson_url)
54
+ SeleniumTrend.create!(:spec_line_failure => spec_line_failure, :spec_name => spec_name, :date => date, :status => status, :time => time, :nested_spec_name => nested_spec_name, :trace => trace, :full_path => full_path, :hudson_build => hudson_build, :hudson_project => hudson_project, :hudson_url => hudson_url)
51
55
  end
52
56
  end
53
57
  end
@@ -1,34 +1,35 @@
1
1
  require 'parallelized_specs'
2
2
 
3
3
  module RSpec
4
-
5
-
6
4
  class ParallelizedSpecs::SlowestSpecLogger < ParallelizedSpecs::SpecLoggerBase
7
5
 
6
+ def initialize
7
+ @examples = []
8
+ super
9
+ end
10
+
8
11
  def example_started(example)
9
12
  @spec_start_time = Time.now
10
13
  end
11
14
 
12
15
  def example_passed(example)
13
- total_time = determine_spec_duration(@spec_start_time)
14
- write_total_spec_time(total_time, example)
16
+ add_total_spec_time(example)
15
17
  end
16
18
 
17
19
  def example_failed(example, count, failure)
18
- total_time = determine_spec_duration(@spec_start_time)
19
- write_total_spec_time(total_time, example)
20
+ add_total_spec_time(example)
20
21
  end
21
22
 
22
- def determine_spec_duration(spec_start_time)
23
- total_time = Time.now - spec_start_time
24
- total_time
25
- end
26
-
27
- def write_total_spec_time(total_time, example)
23
+ def dump_summary
28
24
  lock_output do
29
- @output.puts "#{total_time}*#{example.description}*#{example_group.location}"
25
+ @examples.each { |example| @output.puts "#{example}" }
30
26
  end
31
27
  @output.flush
32
28
  end
29
+
30
+ def add_total_spec_time(example)
31
+ total_time = Time.now - @spec_start_time
32
+ @examples << "#{total_time}*#{example.description}*#{example_group.location}"
33
+ end
33
34
  end
34
35
  end
@@ -2,34 +2,50 @@ require 'parallelized_specs/spec_logger_base'
2
2
 
3
3
  class ParallelizedSpecs::TrendingExampleFailures < ParallelizedSpecs::SpecLoggerBase
4
4
 
5
+ def initialize
6
+ @passed_examples = {}
7
+ @failed_examples = {}
8
+ @pending_examples = {}
9
+ @hudson_build_info = File.read("#{Rails.root}/spec/build_info.txt")
10
+ super
11
+ end
12
+
13
+ def example_started(example)
14
+ @spec_start_time = Time.now
15
+ super
16
+ end
17
+
5
18
  def example_failed(example, counter, failure)
6
- if RSPEC_1
7
- if example.location != nil
8
- @failed_examples ||= {}
9
- @failed_examples["#{example.location.match(/spec.*\d/).to_s}*"] = ["#{example.description}*", "#{failure.header}*", "#{failure.exception.to_s.gsub(/\n/,"")}*", "#{failure.exception.backtrace.to_s.gsub(/\n/,"")}*", "#{Date.today}*"]
10
- end
19
+ total_time = Time.now - @spec_start_time
20
+ if example.location != nil
21
+ @failed_examples["#{example.location.match(/spec.*\d/).to_s}*"] = ["#{example.description}*", "#{Date.today}*", "failed*", "#{total_time}*", "#{failure.header}*", "#{failure.exception.to_s.gsub(/\n/, "")}*", "#{failure.exception.backtrace.to_s.gsub(/\n/)}*"]
11
22
  end
12
23
  end
13
24
 
14
- def dump_summary(*args);end
25
+ def example_passed(example, counter)
26
+ total_time = Time.now - @spec_start_time
27
+ if example.location != nil
28
+ @passed_examples["#{example.location.match(/spec.*\d/).to_s}*"] = ["#{example.description}*", "#{Date.today}*", "passed*", "#{total_time}*","NA*","NA*","NA*"]
29
+ end
30
+ end
15
31
 
16
- def dump_failures(*args);end
17
32
 
18
- def dump_failure(*args);end
33
+ def example_pending(example, counter)
34
+ total_time = Time.now - @spec_start_time
35
+ if example.location != nil
36
+ @pending_examples["#{example.location.match(/spec.*\d/).to_s}*"] = ["#{example.description}*", "#{Date.today}*", "pending*", "#{total_time}*","NA*","NA*","NA*"]
37
+ end
38
+ end
19
39
 
20
- def dump_pending(*args);end
21
40
 
22
41
  def dump_summary(*args)
23
-
24
- if File.exists?("#{Rails.root}/spec/build_info.txt")
25
- @hudson_build_info = File.read("#{Rails.root}/spec/build_info.txt")
26
- else
27
- @hudson_build_info = "no*hudson build*info"
28
- end
29
-
30
42
  lock_output do
31
- (@failed_examples||{}).each_pair do |example, details|
32
- @output.puts "#{example}#{details}#{@hudson_build_info}"
43
+ [@failed_examples, @passed_examples, @pending_examples].each do | example_results |
44
+ unless example_results.empty?
45
+ (example_results).each_pair do |example, details|
46
+ @output.puts "#{example}#{details}#{@hudson_build_info}"
47
+ end
48
+ end
33
49
  end
34
50
  @output.flush
35
51
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.4.65"
8
+ s.version = "0.4.66"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jake Sorce, Bryan Madsen, Shawn Meredith"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallelized_specs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.65
4
+ version: 0.4.66
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: