Class: Hydra::Listener::ReportGenerator

Inherits:
Abstract
  • Object
show all
Defined in:
lib/hydra/listener/report_generator.rb

Overview

Output a textual report at the end of testing

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, #worker_begin, #worker_end

Constructor Details

This class inherits a constructor from Hydra::Listener::Abstract

Instance Method Details

#file_begin(file) ⇒ Object

Log the start time of a file



11
12
13
14
# File 'lib/hydra/listener/report_generator.rb', line 11

def file_begin(file)
  @report[file] ||= { }
  @report[file]['start'] = Time.now.to_f
end

#file_end(file, output) ⇒ Object

Log the end time of a file and compute the file’s testing duration



18
19
20
21
22
# File 'lib/hydra/listener/report_generator.rb', line 18

def file_end(file, output)
  @report[file]['end'] = Time.now.to_f
  @report[file]['duration'] = @report[file]['end'] - @report[file]['start']
  @report[file]['all_tests_passed_last_run'] = (output == '.')
end

#testing_begin(files) ⇒ Object

Initialize a new report



6
7
8
# File 'lib/hydra/listener/report_generator.rb', line 6

def testing_begin(files)
  @report = { }
end

#testing_endObject

output the report



25
26
27
28
# File 'lib/hydra/listener/report_generator.rb', line 25

def testing_end
  YAML.dump(@report, @output)
  @output.close
end