Class: ParallelTests::RSpec::RuntimeLogger
- Inherits:
-
LoggerBase
- Object
- LoggerBase
- ParallelTests::RSpec::RuntimeLogger
- Defined in:
- lib/parallel_tests/rspec/runtime_logger.rb
Constant Summary
Constants inherited from LoggerBase
Instance Method Summary collapse
- #dump_failure(*args) ⇒ Object
- #dump_failures(*args) ⇒ Object
- #dump_pending(*args) ⇒ Object
- #dump_summary(*args) ⇒ Object
- #example_group_finished(example_group) ⇒ Object
- #example_group_started(example_group) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_started(*args) ⇒ Object
-
#initialize(*args) ⇒ RuntimeLogger
constructor
A new instance of RuntimeLogger.
- #start_dump(*args) ⇒ Object
Methods inherited from LoggerBase
Constructor Details
#initialize(*args) ⇒ RuntimeLogger
Returns a new instance of RuntimeLogger.
5 6 7 8 9 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 5 def initialize(*args) super @example_times = Hash.new(0) @group_nesting = 0 if !RSPEC_1 end |
Instance Method Details
#dump_failure(*args) ⇒ Object
40 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 40 def dump_failure(*args);end |
#dump_failures(*args) ⇒ Object
39 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 39 def dump_failures(*args);end |
#dump_pending(*args) ⇒ Object
41 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 41 def dump_pending(*args);end |
#dump_summary(*args) ⇒ Object
38 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 38 def dump_summary(*args);end |
#example_group_finished(example_group) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 29 def example_group_finished(example_group) @group_nesting -= 1 if @group_nesting == 0 @example_times[example_group.file_path] += ParallelTests.now - @time end super end |
#example_group_started(example_group) ⇒ Object
23 24 25 26 27 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 23 def example_group_started(example_group) @time = ParallelTests.now if @group_nesting == 0 @group_nesting += 1 super end |
#example_passed(example) ⇒ Object
17 18 19 20 21 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 17 def example_passed(example) file = example.location.split(':').first @example_times[file] += ParallelTests.now - @time super end |
#example_started(*args) ⇒ Object
12 13 14 15 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 12 def example_started(*args) @time = ParallelTests.now super end |
#start_dump(*args) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 43 def start_dump(*args) return unless ENV['TEST_ENV_NUMBER'] #only record when running in parallel # TODO: Figure out why sometimes time can be less than 0 lock_output do @example_times.each do |file, time| relative_path = file.sub(/^#{Regexp.escape Dir.pwd}\//,'') @output.puts "#{relative_path}:#{time > 0 ? time : 0}" end end @output.flush end |