Class: PerformanceTester::SummaryLogger
- Inherits:
-
Logger
- Object
- Logger
- PerformanceTester::SummaryLogger
show all
- Defined in:
- lib/performance_tester/summary_logger.rb
Overview
Prints summary data to stdout
Instance Attribute Summary
Attributes inherited from Logger
#options, #outcome, #run_name
Instance Method Summary
collapse
Methods inherited from Logger
#initialize
Instance Method Details
#d(value) ⇒ Object
18
19
20
|
# File 'lib/performance_tester/summary_logger.rb', line 18
def d(value)
sprintf("%.02f", value)
end
|
#error ⇒ Object
22
23
24
|
# File 'lib/performance_tester/summary_logger.rb', line 22
def error
outcome.error
end
|
#log ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/performance_tester/summary_logger.rb', line 6
def log
puts "Test run: #{run_name}"
puts "Success: #{outcome.success?}"
puts "Number of requests: #{number_of_requests}"
puts "Sum of request times: #{d(sum_of_times_of_all_requests)}"
puts "Total time elapsed: #{d(total_time_elapsed)}"
unless outcome.success?
puts "Error: #{error.message}"
puts error.backtrace.join("\n")
end
end
|
#number_of_requests ⇒ Object
30
31
32
|
# File 'lib/performance_tester/summary_logger.rb', line 30
def number_of_requests
outcome.requests.length
end
|
#sum_of_times_of_all_requests ⇒ Object
34
35
36
|
# File 'lib/performance_tester/summary_logger.rb', line 34
def sum_of_times_of_all_requests
outcome.requests.map(&:time_elapsed).reduce(&:+)
end
|
#total_time_elapsed ⇒ Object
26
27
28
|
# File 'lib/performance_tester/summary_logger.rb', line 26
def total_time_elapsed
outcome.total_time_elapsed
end
|