ruby-jmeter 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ruby-jmeter/helpers/jmeter.properties +1 -1
- data/lib/ruby-jmeter/helpers/parser.rb +10 -9
- data/lib/ruby-jmeter/version.rb +1 -1
- data/spec/dsl_spec.rb +22 -3
- metadata +2 -2
@@ -2,13 +2,13 @@ module RubyJmeter
|
|
2
2
|
module Parser
|
3
3
|
|
4
4
|
def parse_http_request(params)
|
5
|
-
parse_url(params) unless params[:url].empty?
|
6
|
-
|
7
5
|
if params[:raw_path]
|
8
6
|
params[:path] = params[:url]
|
7
|
+
parse_url(params)
|
9
8
|
else
|
9
|
+
parse_url(params)
|
10
10
|
params[:fill_in] ||= {}
|
11
|
-
params[:params] && params[:params].split('&').each do |param|
|
11
|
+
params[:params] && params[:params].split('&').each do |param|
|
12
12
|
name,value = param.split('=')
|
13
13
|
params[:fill_in][name] = value
|
14
14
|
end
|
@@ -19,9 +19,10 @@ module RubyJmeter
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def parse_url(params)
|
22
|
+
return if params[:url].empty?
|
22
23
|
if params[:url] =~ /https?:\/\/\$/ || params[:url][0] == '$'
|
23
24
|
params[:path] = params[:url] # special case for named expressions
|
24
|
-
else
|
25
|
+
else
|
25
26
|
uri = parse_uri(params[:url])
|
26
27
|
params[:port] ||= uri.port unless URI.parse(URI::encode(params[:url])).scheme.nil?
|
27
28
|
params[:protocol] ||= uri.scheme unless URI.parse(URI::encode(params[:url])).scheme.nil?
|
@@ -33,9 +34,9 @@ module RubyJmeter
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def parse_uri(uri)
|
36
|
-
URI.parse(URI::encode(uri)).scheme.nil? ?
|
37
|
-
URI.parse(URI::encode("http://#{uri}")) :
|
38
|
-
URI.parse(URI::encode(uri))
|
37
|
+
URI.parse(URI::encode(uri)).scheme.nil? ?
|
38
|
+
URI.parse(URI::encode("http://#{uri}")) :
|
39
|
+
URI.parse(URI::encode(uri))
|
39
40
|
end
|
40
41
|
|
41
42
|
def fill_in(params)
|
@@ -68,7 +69,7 @@ module RubyJmeter
|
|
68
69
|
|
69
70
|
params[:update_at_xpath] << {
|
70
71
|
:xpath => '//collectionProp',
|
71
|
-
:value => Nokogiri::XML(<<-EOF.strip_heredoc).children
|
72
|
+
:value => Nokogiri::XML(<<-EOF.strip_heredoc).children
|
72
73
|
<elementProp name="" elementType="HTTPArgument">
|
73
74
|
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
74
75
|
<stringProp name="Argument.value">#{params[:raw_body]}</stringProp>
|
@@ -101,6 +102,6 @@ module RubyJmeter
|
|
101
102
|
2
|
102
103
|
end
|
103
104
|
end
|
104
|
-
|
105
|
+
|
105
106
|
end
|
106
107
|
end
|
data/lib/ruby-jmeter/version.rb
CHANGED
data/spec/dsl_spec.rb
CHANGED
@@ -44,7 +44,7 @@ describe "DSL" do
|
|
44
44
|
|
45
45
|
it 'should match on user_agent' do
|
46
46
|
fragment.search(".//stringProp[@name='Header.name']").text.should == 'User-Agent'
|
47
|
-
fragment.search(".//stringProp[@name='Header.value']").text.should ==
|
47
|
+
fragment.search(".//stringProp[@name='Header.value']").text.should ==
|
48
48
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5'
|
49
49
|
end
|
50
50
|
end
|
@@ -53,8 +53,8 @@ describe "DSL" do
|
|
53
53
|
describe 'http request defaults' do
|
54
54
|
let(:doc) do
|
55
55
|
test do
|
56
|
-
defaults domain: 'example.com',
|
57
|
-
protocol: 'https',
|
56
|
+
defaults domain: 'example.com',
|
57
|
+
protocol: 'https',
|
58
58
|
image_parser: true,
|
59
59
|
implementation: 'HttpClient3.1',
|
60
60
|
concurrentDwn: true,
|
@@ -271,6 +271,25 @@ describe "DSL" do
|
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
274
|
+
describe 'visit raw_path' do
|
275
|
+
let(:doc) do
|
276
|
+
test do
|
277
|
+
threads do
|
278
|
+
transaction name: "TC_02" do
|
279
|
+
post url: "/home?location=melbourne", raw_path: true
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end.to_doc
|
283
|
+
end
|
284
|
+
|
285
|
+
let(:fragment) { doc.search("//HTTPSamplerProxy").first }
|
286
|
+
|
287
|
+
it 'should match on path' do
|
288
|
+
fragment.search(".//stringProp[@name='HTTPSampler.path']").text.should == '/home?location=melbourne'
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|
292
|
+
|
274
293
|
|
275
294
|
describe 'https' do
|
276
295
|
let(:doc) do
|
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.2
|
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-
|
12
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|