mini_autobot 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9a66755f03b9f074006e955769b02cb13b3ab11
4
- data.tar.gz: 6512851e92b042416ccc3a6455951ecc0e06a573
3
+ metadata.gz: 85fd0829c123f45ea778120fc90ee5e2c04a627b
4
+ data.tar.gz: 69a62bdef541daa9348ab6d8f3876f05d444836f
5
5
  SHA512:
6
- metadata.gz: 2d0089d046a37e54d87f9f3b085695812f511d50516c0b0bd11d5f83d169ed3c06b47a3613a232359a8edd139fa9e50e284b9dabe334b13e62bc17fcf5cc229c
7
- data.tar.gz: 936e778a33831c3353b8707191136a470c274ac437921a12544c5124f919586e298c45aea0afc331722c741c7e2cd9aa477feb6862cc174698b1bdb6e5a95d95
6
+ metadata.gz: 3713ac9f4aafd4f19b2bb41c63446cf3cb397d77aa5dc0a96c6f31338e686e5c8c3c5cd67bc2f40af7ce8d1629f7591c8f341c5163a152a626054134271851c1
7
+ data.tar.gz: 9130a15054e3edf435825f08060647d9c6f5e4ff9addc20333a8890792854fd7112e15631cd3a864caf6b3c869dfb6f7064763ef43d139c89b09f67920e50238
@@ -17,6 +17,9 @@ module MiniAutobot
17
17
 
18
18
  @pids = []
19
19
  @static_run_command = "mini_autobot -c #{MiniAutobot.settings.connector} -e #{MiniAutobot.settings.env}"
20
+ if MiniAutobot.settings.rerun_failure
21
+ @static_run_command += " -R #{MiniAutobot.settings.rerun_failure}"
22
+ end
20
23
  tap_reporter_path = MiniAutobot.gem_root.join('lib/tapout/custom_reporters/fancy_tap_reporter.rb')
21
24
  @pipe_tap = "--tapy | tapout --no-color -r #{tap_reporter_path.to_s} fancytap"
22
25
  end
@@ -3,6 +3,7 @@ module MiniAutobot
3
3
 
4
4
  attr_accessor :options
5
5
  @after_hooks = []
6
+ @@rerun_count = 0
6
7
 
7
8
  def self.after_run(&blk)
8
9
  @after_hooks << blk
@@ -21,6 +22,22 @@ module MiniAutobot
21
22
 
22
23
  self.before_run
23
24
 
25
+ reporter = self.single_run
26
+
27
+ rerun_failure = @options[:rerun_failure]
28
+ if rerun_failure && !reporter.passed?
29
+ while @@rerun_count < rerun_failure && !reporter.passed?
30
+ reporter = self.single_run
31
+ @@rerun_count += 1
32
+ end
33
+ end
34
+
35
+ reporter.passed?
36
+ end
37
+
38
+ # Inialize a new reporter, run test
39
+ # Return reporter, which carrys test result
40
+ def self.single_run
24
41
  reporter = Minitest::CompositeReporter.new
25
42
  reporter << Minitest::SummaryReporter.new(@options[:io], @options)
26
43
  reporter << Minitest::ProgressReporter.new(@options[:io], @options)
@@ -34,7 +51,7 @@ module MiniAutobot
34
51
  Minitest.parallel_executor.shutdown
35
52
  reporter.report
36
53
 
37
- reporter.passed?
54
+ reporter
38
55
  end
39
56
 
40
57
  # before hook where you have parsed @options when loading tests
@@ -60,6 +60,10 @@ module MiniAutobot
60
60
  hsh.fetch(:reuse_driver, false)
61
61
  end
62
62
 
63
+ def rerun_failure
64
+ hsh.fetch(:rerun_failure)
65
+ end
66
+
63
67
  def seed
64
68
  hsh.fetch(:seed, nil).to_i
65
69
  end
@@ -58,6 +58,7 @@ module MiniAutobot
58
58
  # @return [void]
59
59
  def teardown
60
60
  if !passed? && !skipped? && !@driver.nil?
61
+ save_to_ever_failed if MiniAutobot.settings.rerun_failure
61
62
  take_screenshot
62
63
  print_sauce_link if connector_is_saucelabs?
63
64
  end
@@ -76,6 +77,17 @@ module MiniAutobot
76
77
  @driver.save_screenshot("logs/#{name}.png")
77
78
  end
78
79
 
80
+ # Save test name to ever_failed_tests file only for the first time it failed
81
+ def save_to_ever_failed
82
+ ever_failed_tests = 'logs/tap_results/ever_failed_tests'
83
+ File.open(ever_failed_tests, 'a') do |f|
84
+ existing_failed_tests = File.readlines(ever_failed_tests).map do |line|
85
+ line.delete "\n"
86
+ end
87
+ f.puts name unless existing_failed_tests.include? name
88
+ end
89
+ end
90
+
79
91
  # Print out a link of a saucelabs's job when a test is not passed
80
92
  # Rescue to skip this step for tests like cube tracking
81
93
  def print_sauce_link
@@ -1,3 +1,3 @@
1
1
  module MiniAutobot
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -72,6 +72,12 @@ module Minitest
72
72
  parser.on('-P', '--parallel PARALLEL', 'Run any number of tests in parallel') do |value|
73
73
  options[:parallel] = value
74
74
  end
75
+
76
+ options[:rerun_failure] = false
77
+ parser.on('-R', '--rerun-failure [RERUN]', 'Rerun failing test; If enabled, can set number of times to rerun') do |value|
78
+ integer_value = value.nil? ? 1 : value.to_i
79
+ options[:rerun_failure] = integer_value
80
+ end
75
81
  end
76
82
 
77
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_autobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ripta Pasay
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-09-22 00:00:00.000000000 Z
13
+ date: 2015-10-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
291
  version: '0'
292
292
  requirements: []
293
293
  rubyforge_project:
294
- rubygems_version: 2.2.2
294
+ rubygems_version: 2.4.6
295
295
  signing_key:
296
296
  specification_version: 4
297
297
  summary: Web automation framework on minitest, selenium webdriver, and page objects.