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