Class: PuppetCatalogTest::StdoutReporter
- Inherits:
-
Object
- Object
- PuppetCatalogTest::StdoutReporter
- Defined in:
- lib/puppet-catalog-test/stdout_reporter.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(stdout_target = $stdout) ⇒ StdoutReporter
constructor
A new instance of StdoutReporter.
- #report_failed_test_case(tc) ⇒ Object
- #report_passed_test_case(tc) ⇒ Object
- #summarize(test_run) ⇒ Object
Constructor Details
#initialize(stdout_target = $stdout) ⇒ StdoutReporter
Returns a new instance of StdoutReporter.
3 4 5 |
# File 'lib/puppet-catalog-test/stdout_reporter.rb', line 3 def initialize(stdout_target = $stdout) @out = stdout_target end |
Instance Method Details
#report_failed_test_case(tc) ⇒ Object
11 12 13 |
# File 'lib/puppet-catalog-test/stdout_reporter.rb', line 11 def report_failed_test_case(tc) @out.puts "[FAILED] #{tc.name} (compile time: #{tc.duration} seconds)" end |
#report_passed_test_case(tc) ⇒ Object
7 8 9 |
# File 'lib/puppet-catalog-test/stdout_reporter.rb', line 7 def report_passed_test_case(tc) @out.puts "[PASSED] #{tc.name} (compile time: #{tc.duration} seconds)" end |
#summarize(test_run) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/puppet-catalog-test/stdout_reporter.rb', line 15 def summarize(test_run) failed_cases = test_run.test_cases.select { |tc| tc.passed == false } avg_time = test_run.total_duration / test_run.test_cases.size @out.puts @out.puts "-" * 40 @out.puts "Compiled %d catalogs in %.4f seconds (avg: %.4f seconds)" % [ test_run.test_cases.size, test_run.total_duration, avg_time ] if !failed_cases.empty? @out.puts "#{failed_cases.size} test cases failed." @out.puts failed_cases.each do |tc| @out.puts " [F] #{tc.name}:" @out.puts " #{tc.error}" @out.puts end @out.puts "#{failed_cases.size} / #{test_run.test_cases.size} FAILED" end end |