Class: JmeterReports::Views::AsciiSummaryList

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

Constant Summary collapse

HEADERS =
[:filename,:start,:end,:samples,:avg_thrput]

Instance Method Summary collapse

Constructor Details

#initialize(files) ⇒ AsciiSummaryList

Returns a new instance of AsciiSummaryList.



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

def initialize(files)
  @files = files
end

Instance Method Details

#renderObject



25
26
27
# File 'lib/jmeter/reports/views/ascii_summary_list.rb', line 25

def render
  Formatador.display_compact_table(report_data, HEADERS)
end

#report_data(color = true) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jmeter/reports/views/ascii_summary_list.rb', line 10

def report_data(color = true)
  data = []
  @files.each do |filename|
    r = JmeterReports::Summary.create(filename)
    data << { 
      :filename   => (color ? "[yellow]#{File.basename(filename)}[/]" : File.basename(filename)), 
      :start      => r.start_date, 
      :end        => r.end_date, 
      :samples    => (color ? "[blue]#{r.total_requests}[/]" : r.total_requests), 
      :avg_thrput => "#{r.avg_throughput} RPS" 
    }
  end
  return data
end