front_end_loader 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -86,22 +86,17 @@ of the script will be run in order and will not affect other iterations that may
86
86
  Excuting an experiment will produce output like this:
87
87
 
88
88
  ```
89
- ------------------------------------------------------------------------------------------------------
90
- | call | count | avg time | max time | errors | error % | throughput |
91
- ------------------------------------------------------------------------------------------------------
92
- | profile | 40 | 0.252 | 0.731 | 0 | 0.0 | 140 |
93
- | random search | 40 | 0.275 | 0.491 | 0 | 0.0 | 140 |
94
- | filtered_search | 40 | 0.28 | 0.67 | 0 | 0.0 | 140 |
95
- | suggestions | 40 | 0.264 | 0.624 | 0 | 0.0 | 140 |
96
- | autocomplete | 38 | 0.234 | 0.456 | 0 | 0.0 | 133 |
97
- | filtered autocomplete | 37 | 0.204 | 0.323 | 0 | 0.0 | 130 |
98
- | services | 37 | 0.203 | 0.476 | 0 | 0.0 | 130 |
99
- | service types | 37 | 0.185 | 0.456 | 0 | 0.0 | 130 |
100
- | me | 36 | 0.25 | 0.555 | 0 | 0.0 | 126 |
101
- | | | | | | | |
102
- | TOTAL | 345 | 0.238 | 0.731 | 0 | 0.0 | 1209 |
103
- ------------------------------------------------------------------------------------------------------
104
- run time: 0:00:17
89
+ ------------------------------------------------------------------------------------------
90
+ | call | count | avg time | max time | errors | error % | throughput |
91
+ ------------------------------------------------------------------------------------------
92
+ | test_search | 100 | 0.36 | 0.863 | 0 | 0.0 | 1450 |
93
+ | random_word_search | 100 | 0.263 | 0.708 | 0 | 0.0 | 1450 |
94
+ | privacy_policy | 100 | 0.038 | 0.056 | 0 | 0.0 | 1450 |
95
+ | | | | | | | |
96
+ | TOTAL | 300 | 0.22 | 0.863 | 0 | 0.0 | 4352 |
97
+ ------------------------------------------------------------------------------------------
98
+
99
+ run time: 0:00:11
105
100
  ```
106
101
 
107
102
  Throughput is measured in requests per minute and note that because each "user" is running though the script
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'front_end_loader'
6
- s.version = '0.2.3'
6
+ s.version = '0.3.0'
7
7
 
8
8
  s.summary = 'A framework for doing declarative load testing in ruby'
9
9
  s.description = <<-EOF
@@ -4,6 +4,8 @@ module FrontEndLoader
4
4
  attr_accessor :user_count
5
5
  attr_accessor :loop_count
6
6
  attr_accessor :default_parameters
7
+ attr_accessor :default_headers
8
+ attr_accessor :timeout, :connect_timeout
7
9
  attr_reader :basic_auth_enabled
8
10
  attr_reader :basic_auth_user
9
11
  attr_reader :basic_auth_password
@@ -166,9 +168,9 @@ module FrontEndLoader
166
168
  session.auth_type = :basic
167
169
  session.username = basic_auth_user
168
170
  session.password = basic_auth_password
169
- session.connect_timeout = 10
170
- session.timeout = 500
171
171
  end
172
+ session.connect_timeout = connect_timeout || 10
173
+ session.timeout = timeout || 500
172
174
  end
173
175
  end
174
176
 
@@ -1,12 +1,18 @@
1
1
  module FrontEndLoader
2
2
  class Request
3
- def initialize(experiment, session, method, name, path, params, data, response_block)
3
+ def initialize(experiment, session, method, name, path, params, data, files = {}, response_block)
4
4
  @experiment = experiment
5
5
  @session = session
6
6
  @method = method
7
7
  @name = name
8
8
  @path = path
9
- @params = URI.encode(@experiment.default_parameters.merge(params).map { |k,v| "#{k}=#{v}" }.join('&'))
9
+ @files = files
10
+
11
+ @headers = @experiment.default_headers || {}
12
+
13
+ param_hash = @experiment.default_parameters ? @experiment.default_parameters.merge(params) : params
14
+ @params = URI.encode(param_hash.map { |k,v| "#{k}=#{v}" }.join('&'))
15
+
10
16
  @data = data
11
17
  @response_block = response_block
12
18
  end
@@ -15,11 +21,15 @@ module FrontEndLoader
15
21
  response = nil
16
22
  if [:get, :delete].include?(@method)
17
23
  response = @experiment.time_call(@name) do
18
- @session.__send__(@method, "#{@path}?#{@params}")
24
+ @session.__send__(@method, "#{@path}?#{@params}", @headers)
25
+ end
26
+ elsif @method == :post_multipart
27
+ response = @experiment.time_call(@name) do
28
+ @session.post_multipart("#{@path}?#{@params}", @data, @files, @headers)
19
29
  end
20
30
  else
21
31
  response = @experiment.time_call(@name) do
22
- @session.__send__(@method, "#{@path}?#{@params}", @data, {'Content-Type' => 'application/json'})
32
+ @session.__send__(@method, "#{@path}?#{@params}", @data, @headers)
23
33
  end
24
34
  end
25
35
  if @response_block && response.is_a?(Patron::Response)
@@ -9,6 +9,10 @@ module FrontEndLoader
9
9
  Request.new(@experiment, @session, :get, name, path, params, nil, block).run
10
10
  end
11
11
 
12
+ def post_multipart(name, path, params = {}, data = "{}", files = nil, &block)
13
+ Request.new(@experiment, @session, :post_multipart, name, path, params, data, files, block).run
14
+ end
15
+
12
16
  def post(name, path, params={}, data="{}", &block)
13
17
  Request.new(@experiment, @session, :post, name, path, params, data, block).run
14
18
  end
@@ -21,6 +25,14 @@ module FrontEndLoader
21
25
  Request.new(@experiment, @session, :delete, name, path, params, nil, block).run
22
26
  end
23
27
 
28
+ def propfind(name, path, params={}, &block)
29
+ Request.new(@experiment, @session, :propfind, name, path, params, nil, block).run
30
+ end
31
+
32
+ def report(name, path, params={}, &block)
33
+ Request.new(@experiment, @session, :report, name, path, params, nil, block).run
34
+ end
35
+
24
36
  def debug(data)
25
37
  @experiment.write_debug(data)
26
38
  end
@@ -68,7 +68,7 @@ module FrontEndLoader
68
68
  total_calls = @experiment.call_counts.values.inject(0) { |s,i| s + i }
69
69
  total_time = @experiment.call_times.values.inject(0) { |s,i| s + i }
70
70
  total_errors = @experiment.call_error_counts.values.inject(0) { |s,i| s + i }
71
- max_max_time = @experiment.call_max_times.values.max.round(3).to_s
71
+ max_max_time = (@experiment.call_max_times.values.max || 0).round(3).to_s
72
72
  delta = ((@experiment.run_completed_time || Time.now) - @experiment.run_start_time) / 60.0
73
73
  end
74
74
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: front_end_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-08 00:00:00.000000000 Z
12
+ date: 2012-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: patron
16
+ prerelease: false
16
17
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
+ none: false
22
23
  type: :runtime
23
- prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
25
  requirements:
27
26
  - - ! '>='
28
27
  - !ruby/object:Gem::Version
29
28
  version: '0'
29
+ none: false
30
30
  description: ! 'Front End Loader allows clients to declare load tests using a pure-Ruby
31
31
  DSL.
32
32
 
@@ -57,17 +57,17 @@ rdoc_options: []
57
57
  require_paths:
58
58
  - lib
59
59
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
60
  requirements:
62
61
  - - ! '>='
63
62
  - !ruby/object:Gem::Version
64
63
  version: '0'
65
- required_rubygems_version: !ruby/object:Gem::Requirement
66
64
  none: false
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
66
  requirements:
68
67
  - - ! '>='
69
68
  - !ruby/object:Gem::Version
70
69
  version: 1.3.5
70
+ none: false
71
71
  requirements: []
72
72
  rubyforge_project:
73
73
  rubygems_version: 1.8.24
@@ -75,3 +75,4 @@ signing_key:
75
75
  specification_version: 2
76
76
  summary: A framework for doing declarative load testing in ruby
77
77
  test_files: []
78
+ has_rdoc: