jmeter-reports 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,18 +3,27 @@
3
3
  $:.push File.join(File.dirname(__FILE__), '..'), File.join(File.dirname(__FILE__), '..','lib')
4
4
  require 'jmeter/reports'
5
5
 
6
- if ARGV[0] == nil || ARGV[0].empty?
6
+ if ARGV.empty?
7
7
  puts "Usage: #{File.basename(__FILE__)} <report_file>"
8
8
  exit 1
9
9
  end
10
10
 
11
11
  begin
12
- report = Jmeter::SummaryReport::Report.create(ARGV[0])
13
- puts "Test time: #{report.elapsed} secs"
14
- puts "Average throughput: #{report.avg_throughput} RPS"
15
- puts "Test plan:"
16
- report.items.each do |item|
17
- puts "\t#{item.text_summary}"
12
+ if ARGV.size > 1
13
+ puts "filename,elapsed,requests,avg_throughput"
14
+ ARGV.each do |filename|
15
+ r = Jmeter::SummaryReport::Report.create(filename)
16
+ puts "#{filename},#{r.elapsed},#{r.total_requests},#{r.avg_throughput}"
17
+ end
18
+ else
19
+ report = Jmeter::SummaryReport::Report.create(ARGV.first)
20
+ puts "Test time: #{report.elapsed} secs"
21
+ puts "Total requests: #{report.total_requests}"
22
+ puts "Average throughput: #{report.avg_throughput} RPS"
23
+ puts "Test plan:"
24
+ report.items.each do |item|
25
+ puts "\t#{item.text_summary}"
26
+ end
18
27
  end
19
28
  rescue Exception => e
20
29
  puts e.message
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "jmeter-reports"
7
- gem.version = "0.0.2"
7
+ gem.version = "0.0.3"
8
8
  gem.authors = ["Marcos Hack"]
9
9
  gem.email = ["marcos.hack@gmail.com"]
10
10
  gem.description = %q{JMeter Reports}
@@ -47,6 +47,10 @@ module Jmeter
47
47
  def items
48
48
  @items.values
49
49
  end
50
+
51
+ def total_requests
52
+ @req_count
53
+ end
50
54
  end
51
55
  end
52
56
  end
@@ -7,9 +7,9 @@ module Jmeter
7
7
  @error_count = 0
8
8
  end
9
9
 
10
- def add(item)
11
- @error_count += 1 if item.error?
12
- @items << item.elapsed
10
+ def add(line)
11
+ @error_count += 1 if line.error?
12
+ @items << line.elapsed
13
13
  end
14
14
 
15
15
  def size
@@ -14,7 +14,7 @@ module Jmeter
14
14
  attr_accessor :timestamp, :elapsed, :label, :error, :latency
15
15
 
16
16
  def self.parse(line)
17
- t,e,l,rc,rm,_,_,s,_,_,_,_,lt = line.split(",")
17
+ t,e,l,rc,rm,_,_,_,s,_,_,_,_,lt = line.split(",")
18
18
  res = Jmeter::SummaryReport::ResultLine.new
19
19
  res.timestamp = t.to_i
20
20
  res.elapsed = e.to_i
@@ -0,0 +1,13 @@
1
+ require File.expand_path('helper', File.dirname(__FILE__))
2
+ require 'jmeter/reports'
3
+
4
+ module Jmeter
5
+ module SummaryReport
6
+ class TestResultLine < MiniTest::Unit::TestCase
7
+ def test_parse_with_error_line
8
+ line = ResultLine.parse('1355163053904,5933,Login,,"Number of samples in transaction : 2, number of failing samples : 1",Thread Group 1-15,,false,2836,20,20,null,0')
9
+ assert_equal true, line.error?
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,25 +1,29 @@
1
1
  require File.expand_path('helper', File.dirname(__FILE__))
2
2
  require 'jmeter/reports'
3
3
 
4
- class TestSummaryReport < MiniTest::Unit::TestCase
5
- def setup
6
- fixture = File.expand_path('fixtures/summary_report.csv', File.dirname(__FILE__))
7
- @report = Jmeter::SummaryReport::Report.create(fixture)
8
- end
4
+ module Jmeter
5
+ module SummaryReport
6
+ class TestReport < MiniTest::Unit::TestCase
7
+ def setup
8
+ fixture = File.expand_path('fixtures/summary_report.csv', File.dirname(__FILE__))
9
+ @report = Report.create(fixture)
10
+ end
9
11
 
10
- def test_report_items
11
- assert_equal 3, @report.items.size
12
- end
12
+ def test_report_items
13
+ assert_equal 3, @report.items.size
14
+ end
13
15
 
14
- def test_avg_throughput
15
- assert_equal 3, @report.avg_throughput
16
- end
16
+ def test_avg_throughput
17
+ assert_equal 3, @report.avg_throughput
18
+ end
17
19
 
18
- def test_elapsed_in_ms
19
- assert_equal 2719, @report.elapsed_in_ms
20
- end
20
+ def test_elapsed_in_ms
21
+ assert_equal 2719, @report.elapsed_in_ms
22
+ end
21
23
 
22
- def test_elapsed
23
- assert_equal 3, @report.elapsed
24
+ def test_elapsed
25
+ assert_equal 3, @report.elapsed
26
+ end
27
+ end
24
28
  end
25
- end
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jmeter-reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-11 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -66,6 +66,7 @@ files:
66
66
  - lib/jmeter/summary_report/result_line.rb
67
67
  - test/fixtures/summary_report.csv
68
68
  - test/helper.rb
69
+ - test/test_result_line.rb
69
70
  - test/test_summary_report.rb
70
71
  homepage: https://github.com/marcoshack/jmeter-reports
71
72
  licenses: []
@@ -94,5 +95,6 @@ summary: Basic tools for JMeter reports processing.
94
95
  test_files:
95
96
  - test/fixtures/summary_report.csv
96
97
  - test/helper.rb
98
+ - test/test_result_line.rb
97
99
  - test/test_summary_report.rb
98
100
  has_rdoc: