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_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 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 5 def initialize(*args) super @example_times = Hash.new(0) end |
Instance Method Details
#dump_failure(*args) ⇒ Object
21 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 21 def dump_failure(*args);end |
#dump_failures(*args) ⇒ Object
20 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 20 def dump_failures(*args);end |
#dump_pending(*args) ⇒ Object
22 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 22 def dump_pending(*args);end |
#dump_summary(*args) ⇒ Object
19 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 19 def dump_summary(*args);end |
#example_passed(example) ⇒ Object
14 15 16 17 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 14 def example_passed(example) file = example.location.split(':').first @example_times[file] += ParallelTests.now - @time end |
#example_started(*args) ⇒ Object
10 11 12 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 10 def example_started(*args) @time = ParallelTests.now end |
#start_dump(*args) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/parallel_tests/rspec/runtime_logger.rb', line 24 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 |