ruby-jmeter 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/basic_foreach.rb +32 -0
- data/lib/ruby-jmeter/dsl.rb +1 -1
- data/lib/ruby-jmeter/dsl/foreach_controller.rb +0 -2
- data/lib/ruby-jmeter/dsl/loop_controller.rb +1 -1
- data/lib/ruby-jmeter/dsl/thread_group.rb +1 -1
- data/lib/ruby-jmeter/idl.xml +2 -4
- data/lib/ruby-jmeter/version.rb +1 -1
- data/spec/dsl_spec.rb +3 -3
- metadata +4 -6
@@ -0,0 +1,32 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
threads 1, {
|
6
|
+
rampup: 1,
|
7
|
+
scheduler: true,
|
8
|
+
duration: 60,
|
9
|
+
continue_forever: true
|
10
|
+
} do
|
11
|
+
|
12
|
+
defaults domain: 'altentee.com'
|
13
|
+
|
14
|
+
random_timer 1000, 2000
|
15
|
+
|
16
|
+
transaction '01_GET_home' do
|
17
|
+
visit '/' do
|
18
|
+
extract regex: 'href="(.+?)"', name: 'links', match_number: -1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
foreach_controller inputVal: 'links', returnVal: 'link' do
|
23
|
+
transaction '02_GET_random_link' do
|
24
|
+
visit '${link}'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# end.jmx
|
30
|
+
# end.flood(ENV['FLOOD_API_TOKEN'])
|
31
|
+
# end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
32
|
+
end.run(path: '/usr/share/jmeter/bin/')
|
data/lib/ruby-jmeter/dsl.rb
CHANGED
@@ -6,7 +6,7 @@ module RubyJmeter
|
|
6
6
|
def initialize(params = {})
|
7
7
|
@root = Nokogiri::XML(<<-EOF.strip_heredoc)
|
8
8
|
<?xml version="1.0" encoding="UTF-8"?>
|
9
|
-
<jmeterTestPlan version="1.2" properties="2.
|
9
|
+
<jmeterTestPlan version="1.2" properties="2.4" jmeter="2.9 r1437961">
|
10
10
|
<hashTree>
|
11
11
|
</hashTree>
|
12
12
|
</jmeterTestPlan>
|
@@ -17,8 +17,6 @@ module RubyJmeter
|
|
17
17
|
<stringProp name="ForeachController.inputVal"/>
|
18
18
|
<stringProp name="ForeachController.returnVal"/>
|
19
19
|
<boolProp name="ForeachController.useSeparator">true</boolProp>
|
20
|
-
<stringProp name="ForeachController.endIndex"/>
|
21
|
-
<stringProp name="ForeachController.startIndex"/>
|
22
20
|
</ForeachController>)
|
23
21
|
EOS
|
24
22
|
update params
|
@@ -15,7 +15,7 @@ module RubyJmeter
|
|
15
15
|
@doc = Nokogiri::XML(<<-EOS.strip_heredoc)
|
16
16
|
<LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="#{testname}" enabled="true">
|
17
17
|
<boolProp name="LoopController.continue_forever">true</boolProp>
|
18
|
-
<
|
18
|
+
<intProp name="LoopController.loops">1</intProp>
|
19
19
|
</LoopController>)
|
20
20
|
EOS
|
21
21
|
update params
|
@@ -17,7 +17,7 @@ module RubyJmeter
|
|
17
17
|
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
|
18
18
|
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="#{testname}" enabled="true">
|
19
19
|
<boolProp name="LoopController.continue_forever">false</boolProp>
|
20
|
-
<
|
20
|
+
<intProp name="LoopController.loops">1</intProp>
|
21
21
|
</elementProp>
|
22
22
|
<stringProp name="ThreadGroup.num_threads">1</stringProp>
|
23
23
|
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
|
data/lib/ruby-jmeter/idl.xml
CHANGED
@@ -249,7 +249,7 @@
|
|
249
249
|
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
|
250
250
|
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
|
251
251
|
<boolProp name="LoopController.continue_forever">false</boolProp>
|
252
|
-
<
|
252
|
+
<intProp name="LoopController.loops">1</intProp>
|
253
253
|
</elementProp>
|
254
254
|
<stringProp name="ThreadGroup.num_threads">1</stringProp>
|
255
255
|
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
|
@@ -264,8 +264,6 @@
|
|
264
264
|
<stringProp name="ForeachController.inputVal"></stringProp>
|
265
265
|
<stringProp name="ForeachController.returnVal"></stringProp>
|
266
266
|
<boolProp name="ForeachController.useSeparator">true</boolProp>
|
267
|
-
<stringProp name="ForeachController.endIndex"></stringProp>
|
268
|
-
<stringProp name="ForeachController.startIndex"></stringProp>
|
269
267
|
</ForeachController>
|
270
268
|
<hashTree/>
|
271
269
|
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true">
|
@@ -280,7 +278,7 @@
|
|
280
278
|
<hashTree/>
|
281
279
|
<LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
|
282
280
|
<boolProp name="LoopController.continue_forever">true</boolProp>
|
283
|
-
<
|
281
|
+
<intProp name="LoopController.loops">1</intProp>
|
284
282
|
</LoopController>
|
285
283
|
<hashTree/>
|
286
284
|
<ModuleController guiclass="ModuleControllerGui" testclass="ModuleController" testname="Module Controller" enabled="true"/>
|
data/lib/ruby-jmeter/version.rb
CHANGED
data/spec/dsl_spec.rb
CHANGED
@@ -120,7 +120,7 @@ describe "DSL" do
|
|
120
120
|
end
|
121
121
|
|
122
122
|
it 'should match on loops' do
|
123
|
-
fragment.search(".//
|
123
|
+
fragment.search(".//intProp[@name='LoopController.loops']").text.should == '-1'
|
124
124
|
end
|
125
125
|
|
126
126
|
it 'should match on duration' do
|
@@ -147,7 +147,7 @@ describe "DSL" do
|
|
147
147
|
end
|
148
148
|
|
149
149
|
it 'should match on loops' do
|
150
|
-
fragment.search(".//
|
150
|
+
fragment.search(".//intProp[@name='LoopController.loops']").text.should == '-1'
|
151
151
|
end
|
152
152
|
|
153
153
|
it 'should match on duration' do
|
@@ -372,7 +372,7 @@ describe "DSL" do
|
|
372
372
|
let(:fragment) { doc.search("//LoopController").first }
|
373
373
|
|
374
374
|
it 'should match on Loops' do
|
375
|
-
fragment.search(".//
|
375
|
+
fragment.search(".//intProp[@name='LoopController.loops']").text.should == '5'
|
376
376
|
end
|
377
377
|
end
|
378
378
|
|
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.0.
|
4
|
+
version: 2.0.8
|
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-09-
|
12
|
+
date: 2013-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- examples/basic_extract.rb
|
68
68
|
- examples/basic_flood.rb
|
69
69
|
- examples/basic_flood_real.rb
|
70
|
+
- examples/basic_foreach.rb
|
70
71
|
- examples/basic_gc_dummy_sampler.rb
|
71
72
|
- examples/basic_gc_results.rb
|
72
73
|
- examples/basic_google.rb
|
@@ -249,7 +250,4 @@ rubygems_version: 1.8.23
|
|
249
250
|
signing_key:
|
250
251
|
specification_version: 3
|
251
252
|
summary: This is a Ruby based DSL for writing JMeter test plans
|
252
|
-
test_files:
|
253
|
-
- spec/dsl_spec.rb
|
254
|
-
- spec/spec_helper.rb
|
255
|
-
- spec/stub.rb
|
253
|
+
test_files: []
|