Class: JmeterReports::Views::AsciiSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/jmeter/reports/views/ascii_summary.rb

Constant Summary collapse

HEADERS =
[:label,:reqs,:errors,:err_pct,:min,:avg,:max,:sd,:avg_thrput,:pct_90,:pct_95]

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ AsciiSummary

Returns a new instance of AsciiSummary.



6
7
8
# File 'lib/jmeter/reports/views/ascii_summary.rb', line 6

def initialize(report)
  @report = report
end

Instance Method Details

#renderObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/jmeter/reports/views/ascii_summary.rb', line 30

def render
  puts ""
  puts "             Start: #{@report.start_date}"
  puts "               End: #{@report.end_date}"
  puts "          Duration: #{@report.elapsed} secs"
  puts "    Total requests: #{@report.total_requests}"
  puts "Overall throughput: #{@report.avg_throughput} RPS"
  puts ""
  Formatador.display_compact_table(report_data, HEADERS)
  puts ""
  puts "  Time values in milliseconds and throughput in Requests Per Second."
  puts ""
end

#report_data(color = true) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jmeter/reports/views/ascii_summary.rb', line 10

def report_data(color = true)
  data = []
  @report.items.each do |i|
    data << {
      :label      => (color ? "[green]#{i.label}[/]" : i.label), 
      :reqs       => i.size, 
      :errors     => (i.errors > 0 && color ? "[red]#{i.errors}[/]" : i.errors),
      :err_pct    => (i.error_rate * 100).round(1),
      :avg_thrput => "[yellow]#{i.avg_throughput.round(3)}[/]", 
      :min        => i.min,
      :avg        => "[yellow]#{i.avg}[/]", 
      :max        => i.max,
      :sd         => color ? "[yellow]#{i.sd}[/]" : i.sd, 
      :pct_90     => i.percentil(90),
      :pct_95     => i.percentil(95)
    }
  end
  return data
end