ruby-jmeter 2.1.6 → 2.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/basic_flood.rb +2 -2
- data/lib/ruby-jmeter/dsl.rb +16 -15
- data/lib/ruby-jmeter/version.rb +1 -1
- data/ruby-jmeter.gemspec +1 -1
- metadata +7 -4
data/examples/basic_flood.rb
CHANGED
@@ -5,8 +5,8 @@ test do
|
|
5
5
|
threads count: 20 do
|
6
6
|
visit name: 'Home Page', url: 'http://google.com/'
|
7
7
|
end
|
8
|
-
end.flood('
|
8
|
+
end.flood('vgzGtzM5hGv61exPSs6P', {
|
9
9
|
name: 'Demo using flood.io',
|
10
|
-
region: 'us-west-2',
|
10
|
+
region: 'us-west-2',
|
11
11
|
endpoint: 'dev.api.flood.io:3000'
|
12
12
|
})
|
data/lib/ruby-jmeter/dsl.rb
CHANGED
@@ -21,7 +21,7 @@ module RubyJmeter
|
|
21
21
|
# Config Elements
|
22
22
|
|
23
23
|
def user_defined_variables(params, &block)
|
24
|
-
if params.is_a?(Hash)
|
24
|
+
if params.is_a?(Hash)
|
25
25
|
params['Argument.name'] = params[:name]
|
26
26
|
end
|
27
27
|
super
|
@@ -37,7 +37,7 @@ module RubyJmeter
|
|
37
37
|
super
|
38
38
|
end
|
39
39
|
|
40
|
-
alias_method :defaults, :http_request_defaults
|
40
|
+
alias_method :defaults, :http_request_defaults
|
41
41
|
|
42
42
|
def http_cookie_manager(params={}, &block)
|
43
43
|
params[:clearEachIteration] = true if params.keys.include? 'clear_each_iteration'
|
@@ -54,12 +54,12 @@ module RubyJmeter
|
|
54
54
|
alias_method :cache, :http_cache_manager
|
55
55
|
|
56
56
|
def with_user_agent(device)
|
57
|
-
http_header_manager name: 'User-Agent',
|
57
|
+
http_header_manager name: 'User-Agent',
|
58
58
|
value: RubyJmeter::UserAgent.new(device).string
|
59
59
|
end
|
60
60
|
|
61
61
|
def http_header_manager(params, &block)
|
62
|
-
if params.is_a?(Hash)
|
62
|
+
if params.is_a?(Hash)
|
63
63
|
params['Header.name'] = params[:name]
|
64
64
|
end
|
65
65
|
super
|
@@ -133,12 +133,12 @@ module RubyJmeter
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def with_xhr
|
136
|
-
http_header_manager name: 'X-Requested-With',
|
136
|
+
http_header_manager name: 'X-Requested-With',
|
137
137
|
value: 'XMLHttpRequest'
|
138
138
|
end
|
139
139
|
|
140
140
|
def with_gzip
|
141
|
-
http_header_manager name: 'Accept-Encoding',
|
141
|
+
http_header_manager name: 'Accept-Encoding',
|
142
142
|
value: 'gzip, deflate'
|
143
143
|
end
|
144
144
|
|
@@ -162,11 +162,11 @@ module RubyJmeter
|
|
162
162
|
params[:url] = 'http://54.252.206.143:8080/' if params[:stub]
|
163
163
|
|
164
164
|
get name: '__testdata', url: params[:url] do
|
165
|
-
extract name: params[:name],
|
166
|
-
regex: params[:regex],
|
167
|
-
match_num: params[:match_num],
|
165
|
+
extract name: params[:name],
|
166
|
+
regex: params[:regex],
|
167
|
+
match_num: params[:match_num],
|
168
168
|
default: params[:default]
|
169
|
-
end
|
169
|
+
end
|
170
170
|
end
|
171
171
|
|
172
172
|
##
|
@@ -222,7 +222,7 @@ module RubyJmeter
|
|
222
222
|
|
223
223
|
node = RubyJmeter::ThroughputController.new(params)
|
224
224
|
node.doc.xpath(".//FloatProperty/value").first.content = params[:maxThroughput].to_f
|
225
|
-
|
225
|
+
|
226
226
|
attach_node(node, &block)
|
227
227
|
end
|
228
228
|
|
@@ -259,7 +259,7 @@ module RubyJmeter
|
|
259
259
|
def extract(params, &block)
|
260
260
|
node = if params[:regex]
|
261
261
|
params[:refname] = params[:name]
|
262
|
-
params[:regex] = params[:regex] #CGI.escapeHTML
|
262
|
+
params[:regex] = params[:regex] #CGI.escapeHTML
|
263
263
|
params[:template] = params[:template] || "$1$"
|
264
264
|
RubyJmeter::RegularExpressionExtractor.new(params)
|
265
265
|
else
|
@@ -407,8 +407,6 @@ module RubyJmeter
|
|
407
407
|
:flood => {
|
408
408
|
:tool => 'jmeter-2.9',
|
409
409
|
:url => params[:url],
|
410
|
-
:plan => File.new("#{file.path}", 'rb'),
|
411
|
-
:plan_cache => '',
|
412
410
|
:name => params[:name],
|
413
411
|
:notes => params[:notes],
|
414
412
|
:tag_list => params[:tag_list],
|
@@ -419,10 +417,13 @@ module RubyJmeter
|
|
419
417
|
:started => params[:started],
|
420
418
|
:stopped => params[:stopped]
|
421
419
|
},
|
420
|
+
:flood_files => {
|
421
|
+
:file => File.new("#{file.path}", 'rb')
|
422
|
+
},
|
422
423
|
:results => (File.new("#{params[:jtl] ? params[:jtl] : 'jmeter.jtl'}", 'rb') if params[:region] == 'local'),
|
423
424
|
:region => params[:region],
|
424
425
|
:multipart => true,
|
425
|
-
:content_type => 'application/octet-stream'
|
426
|
+
:content_type => 'application/octet-stream'
|
426
427
|
}.merge(params)
|
427
428
|
if response.code == 200
|
428
429
|
logger.info "Flood results at: #{JSON.parse(response)["response"]["results"]["link"]}"
|
data/lib/ruby-jmeter/version.rb
CHANGED
data/ruby-jmeter.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["support@flood.io"]
|
11
11
|
gem.description = %q{This is a Ruby based DSL for writing JMeter test plans}
|
12
12
|
gem.summary = %q{This is a Ruby based DSL for writing JMeter test plans}
|
13
|
-
gem.homepage = "http://
|
13
|
+
gem.homepage = "http://flood-io.github.io/ruby-jmeter/"
|
14
14
|
gem.add_dependency("rest-client")
|
15
15
|
gem.add_dependency("nokogiri")
|
16
16
|
gem.add_runtime_dependency('json-jruby') if RUBY_PLATFORM == 'java'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-jmeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.7
|
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: 2013-11-
|
12
|
+
date: 2013-11-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -230,7 +230,7 @@ files:
|
|
230
230
|
- spec/dsl_spec.rb
|
231
231
|
- spec/spec_helper.rb
|
232
232
|
- spec/stub.rb
|
233
|
-
homepage: http://
|
233
|
+
homepage: http://flood-io.github.io/ruby-jmeter/
|
234
234
|
licenses:
|
235
235
|
- MIT
|
236
236
|
post_install_message:
|
@@ -255,4 +255,7 @@ rubygems_version: 1.8.23
|
|
255
255
|
signing_key:
|
256
256
|
specification_version: 3
|
257
257
|
summary: This is a Ruby based DSL for writing JMeter test plans
|
258
|
-
test_files:
|
258
|
+
test_files:
|
259
|
+
- spec/dsl_spec.rb
|
260
|
+
- spec/spec_helper.rb
|
261
|
+
- spec/stub.rb
|