gridinit-jmeter 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -2
- data/gridinit-jmeter.gemspec +2 -2
- data/lib/gridinit-jmeter.rb +6 -1
- data/lib/gridinit-jmeter/config/random_variable.rb +24 -0
- data/lib/gridinit-jmeter/controllers/if_controller.rb +2 -2
- data/lib/gridinit-jmeter/controllers/interleave.rb +18 -0
- data/lib/gridinit-jmeter/controllers/random_order.rb +16 -0
- data/lib/gridinit-jmeter/controllers/simple.rb +17 -0
- data/lib/gridinit-jmeter/controllers/switch.rb +20 -0
- data/lib/gridinit-jmeter/dsl.rb +120 -131
- data/lib/gridinit-jmeter/helpers/dsl_helper.rb +10 -1
- data/lib/gridinit-jmeter/listeners/aggregate_report.rb +47 -0
- data/lib/gridinit-jmeter/listeners/gc_latencies_over_time.rb +1 -1
- data/lib/gridinit-jmeter/listeners/gc_response_codes_per_second.rb +1 -1
- data/lib/gridinit-jmeter/listeners/gc_response_times_distribution.rb +1 -1
- data/lib/gridinit-jmeter/listeners/gc_response_times_over_time.rb +1 -1
- data/lib/gridinit-jmeter/listeners/gc_response_times_percentiles.rb +1 -1
- data/lib/gridinit-jmeter/listeners/gc_transactions_per_second.rb +1 -1
- data/lib/gridinit-jmeter/listeners/graph_visualizer.rb +1 -1
- data/lib/gridinit-jmeter/listeners/response_time_graph_visualizer.rb +1 -1
- data/lib/gridinit-jmeter/listeners/simple_data_writer.rb +1 -1
- data/lib/gridinit-jmeter/listeners/stat_visualizer.rb +1 -1
- data/lib/gridinit-jmeter/listeners/summary_report.rb +1 -1
- data/lib/gridinit-jmeter/listeners/table_visualizer.rb +1 -1
- data/lib/gridinit-jmeter/listeners/view_results_full_visualizer.rb +14 -3
- data/lib/gridinit-jmeter/post_processors/regex_extractor.rb +13 -3
- data/lib/gridinit-jmeter/pre_processors/bean_shell_pre_processor.rb +3 -1
- data/lib/gridinit-jmeter/threads/thread_group.rb +2 -1
- data/lib/gridinit-jmeter/version.rb +1 -1
- data/spec/dsl_spec.rb +125 -2
- metadata +9 -7
- data/.rbenv-version +0 -1
data/Gemfile
CHANGED
data/gridinit-jmeter.gemspec
CHANGED
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.files = `git ls-files`.split($/)
|
19
19
|
gem.executables << 'grid'
|
20
|
-
gem.test_files =
|
21
|
-
gem.require_paths = [
|
20
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
gem.require_paths = ['lib']
|
22
22
|
end
|
data/lib/gridinit-jmeter.rb
CHANGED
@@ -40,7 +40,7 @@ require 'gridinit-jmeter/helpers/user-agents'
|
|
40
40
|
# require 'gridinit-jmeter/config/ldap_extended_request_defaults'
|
41
41
|
# require 'gridinit-jmeter/config/ldap_request_defaults'
|
42
42
|
# require 'gridinit-jmeter/config/login_config_element'
|
43
|
-
|
43
|
+
require 'gridinit-jmeter/config/random_variable'
|
44
44
|
# require 'gridinit-jmeter/config/simple_config_element'
|
45
45
|
# require 'gridinit-jmeter/config/tcp_sampler_config'
|
46
46
|
require 'gridinit-jmeter/config/user_defined_variable'
|
@@ -90,6 +90,7 @@ require 'gridinit-jmeter/helpers/user-agents'
|
|
90
90
|
require 'gridinit-jmeter/listeners/stat_visualizer'
|
91
91
|
require 'gridinit-jmeter/listeners/simple_data_writer'
|
92
92
|
require 'gridinit-jmeter/listeners/summary_report'
|
93
|
+
require 'gridinit-jmeter/listeners/aggregate_report'
|
93
94
|
require 'gridinit-jmeter/listeners/gc_latencies_over_time'
|
94
95
|
require 'gridinit-jmeter/listeners/gc_response_codes_per_second'
|
95
96
|
require 'gridinit-jmeter/listeners/gc_response_times_distribution'
|
@@ -105,6 +106,10 @@ require 'gridinit-jmeter/helpers/user-agents'
|
|
105
106
|
require 'gridinit-jmeter/controllers/loop_controller'
|
106
107
|
require 'gridinit-jmeter/controllers/throughput'
|
107
108
|
require 'gridinit-jmeter/controllers/while_controller'
|
109
|
+
require 'gridinit-jmeter/controllers/switch'
|
110
|
+
require 'gridinit-jmeter/controllers/random_order'
|
111
|
+
require 'gridinit-jmeter/controllers/simple'
|
112
|
+
require 'gridinit-jmeter/controllers/interleave'
|
108
113
|
|
109
114
|
# SAMPLERS
|
110
115
|
require 'gridinit-jmeter/samplers/http_sampler'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Gridinit
|
2
|
+
module Jmeter
|
3
|
+
|
4
|
+
class RandomVariableConfig
|
5
|
+
attr_accessor :doc
|
6
|
+
include Helper
|
7
|
+
def initialize(name, min, max, params={})
|
8
|
+
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
+
<RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="#{name}" enabled="#{enabled(params)}">
|
10
|
+
<stringProp name="maximumValue">#{max}</stringProp>
|
11
|
+
<stringProp name="minimumValue">#{min}</stringProp>
|
12
|
+
<stringProp name="outputFormat"></stringProp>
|
13
|
+
<boolProp name="perThread">false</boolProp>
|
14
|
+
<stringProp name="randomSeed"></stringProp>
|
15
|
+
<stringProp name="variableName">#{name}</stringProp>
|
16
|
+
</RandomVariableConfig>
|
17
|
+
|
18
|
+
EOF
|
19
|
+
update params
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -4,10 +4,10 @@ module Gridinit
|
|
4
4
|
class IfController
|
5
5
|
attr_accessor :doc
|
6
6
|
include Helper
|
7
|
-
def initialize(name, params={})
|
7
|
+
def initialize(name, condition, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
9
|
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="#{name}" enabled="true">
|
10
|
-
<stringProp name="IfController.condition"
|
10
|
+
<stringProp name="IfController.condition">#{condition}</stringProp>
|
11
11
|
<boolProp name="IfController.evaluateAll">false</boolProp>
|
12
12
|
</IfController>
|
13
13
|
EOF
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Gridinit
|
2
|
+
module Jmeter
|
3
|
+
|
4
|
+
class InterleaveController
|
5
|
+
attr_accessor :doc
|
6
|
+
include Helper
|
7
|
+
def initialize(name, params={})
|
8
|
+
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
+
<InterleaveControl guiclass="InterleaveControlGui" testclass="InterleaveControl" testname="#{name}" enabled="true">
|
10
|
+
<intProp name="InterleaveControl.style">1</intProp>
|
11
|
+
</InterleaveControl>
|
12
|
+
EOF
|
13
|
+
update params
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Gridinit
|
2
|
+
module Jmeter
|
3
|
+
|
4
|
+
class RandomOrderController
|
5
|
+
attr_accessor :doc
|
6
|
+
include Helper
|
7
|
+
def initialize(name, params={})
|
8
|
+
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
+
<RandomOrderController guiclass="RandomOrderControllerGui" testclass="RandomOrderController" testname="#{name}" enabled="true"/>
|
10
|
+
EOF
|
11
|
+
update params
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Gridinit
|
2
|
+
module Jmeter
|
3
|
+
|
4
|
+
class SimpleController
|
5
|
+
attr_accessor :doc
|
6
|
+
include Helper
|
7
|
+
|
8
|
+
def initialize(name, params={})
|
9
|
+
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
10
|
+
<GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="#{name}" enabled="true"/>
|
11
|
+
EOF
|
12
|
+
update params
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Gridinit
|
2
|
+
module Jmeter
|
3
|
+
|
4
|
+
class SwitchController
|
5
|
+
attr_accessor :doc
|
6
|
+
include Helper
|
7
|
+
|
8
|
+
def initialize(name, switch_value, params={})
|
9
|
+
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
10
|
+
<SwitchController guiclass="SwitchControllerGui" testclass="SwitchController" testname="#{name}" enabled="#{enabled(params)}">
|
11
|
+
<stringProp name="SwitchController.value">#{switch_value}</stringProp>
|
12
|
+
</SwitchController>
|
13
|
+
|
14
|
+
EOF
|
15
|
+
update params
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/gridinit-jmeter/dsl.rb
CHANGED
@@ -28,7 +28,10 @@ module Gridinit
|
|
28
28
|
</jmeterTestPlan>
|
29
29
|
EOF
|
30
30
|
node = Gridinit::Jmeter::TestPlan.new
|
31
|
-
|
31
|
+
|
32
|
+
|
33
|
+
@current_node = @root.at_xpath("//jmeterTestPlan/hashTree")
|
34
|
+
@current_node = attach_to_last(node)
|
32
35
|
|
33
36
|
variables(
|
34
37
|
:name => 'testguid',
|
@@ -38,97 +41,87 @@ module Gridinit
|
|
38
41
|
|
39
42
|
def variables(params={}, &block)
|
40
43
|
node = Gridinit::Jmeter::UserDefinedVariable.new(params)
|
41
|
-
|
42
|
-
self.instance_exec(&block) if block
|
44
|
+
attach_node(node, &block)
|
43
45
|
end
|
44
46
|
|
45
47
|
def defaults(params={}, &block)
|
46
48
|
node = Gridinit::Jmeter::RequestDefaults.new(params)
|
47
|
-
|
48
|
-
self.instance_exec(&block) if block
|
49
|
+
attach_node(node, &block)
|
49
50
|
end
|
50
51
|
|
51
52
|
def cookies(params={}, &block)
|
52
53
|
node = Gridinit::Jmeter::CookieManager.new(params)
|
53
|
-
|
54
|
-
self.instance_exec(&block) if block
|
54
|
+
attach_node(node, &block)
|
55
55
|
end
|
56
56
|
|
57
57
|
def cache(params={}, &block)
|
58
58
|
node = Gridinit::Jmeter::CacheManager.new(params)
|
59
|
-
|
60
|
-
self.instance_exec(&block) if block
|
59
|
+
attach_node(node, &block)
|
61
60
|
end
|
62
61
|
|
63
62
|
def header(params={}, &block)
|
64
63
|
node = Gridinit::Jmeter::HeaderManager.new(params)
|
65
|
-
|
66
|
-
self.instance_exec(&block) if block
|
64
|
+
attach_node(node, &block)
|
67
65
|
end
|
68
66
|
|
69
67
|
def with_xhr(params={}, &block)
|
70
68
|
node = Gridinit::Jmeter::HeaderManager.new(
|
71
69
|
params.merge('X-Requested-With' => 'XMLHttpRequest')
|
72
70
|
)
|
73
|
-
|
74
|
-
self.instance_exec(&block) if block
|
71
|
+
attach_node(node, &block)
|
75
72
|
end
|
76
73
|
|
77
74
|
def with_user_agent(device, params={}, &block)
|
78
75
|
node = Gridinit::Jmeter::HeaderManager.new(
|
79
76
|
params.merge('User-Agent' => Gridinit::Jmeter::UserAgent.new(device).string)
|
80
77
|
)
|
81
|
-
|
82
|
-
self.instance_exec(&block) if block
|
78
|
+
attach_node(node, &block)
|
83
79
|
end
|
84
80
|
|
85
81
|
def auth(params={}, &block)
|
86
82
|
node = Gridinit::Jmeter::AuthManager.new(params)
|
87
|
-
|
88
|
-
self.instance_exec(&block) if block
|
83
|
+
attach_node(node, &block)
|
89
84
|
end
|
90
85
|
|
91
86
|
def threads(num_threads=1, params={}, &block)
|
92
87
|
node = Gridinit::Jmeter::ThreadGroup.new(num_threads, params)
|
93
|
-
|
94
|
-
self.instance_exec(&block) if block
|
88
|
+
attach_node(node, &block)
|
95
89
|
end
|
96
90
|
|
97
91
|
def transaction(name="Transaction Contoller", params={}, &block)
|
98
92
|
node = Gridinit::Jmeter::Transaction.new(name, params)
|
99
|
-
|
100
|
-
self.instance_exec(&block) if block
|
93
|
+
attach_node(node, &block)
|
101
94
|
end
|
102
95
|
|
103
96
|
def exists(var, params={}, &block)
|
104
97
|
params[:condition] = "'${#{var}}'.length > 0"
|
105
|
-
node
|
106
|
-
|
107
|
-
self.instance_exec(&block) if block
|
98
|
+
node = Gridinit::Jmeter::IfController.new("if #{var}", params)
|
99
|
+
attach_node(node, &block)
|
108
100
|
end
|
109
101
|
|
110
102
|
def once(name="do once", params={}, &block)
|
111
103
|
node = Gridinit::Jmeter::OnceOnly.new(name, params)
|
112
|
-
|
113
|
-
self.instance_exec(&block) if block
|
104
|
+
attach_node(node, &block)
|
114
105
|
end
|
115
106
|
|
116
107
|
def throughput(name="throughput", percent=100.0, params={}, &block)
|
117
108
|
node = Gridinit::Jmeter::Throughput.new(name, percent, params)
|
118
|
-
|
119
|
-
self.instance_exec(&block) if block
|
109
|
+
attach_node(node, &block)
|
120
110
|
end
|
121
111
|
|
122
|
-
def If(name="If Controller", params={}, &block)
|
123
|
-
node = Gridinit::Jmeter::IfController.new(name, params)
|
124
|
-
|
125
|
-
self.instance_exec(&block) if block
|
112
|
+
def If(name="If Controller", condition="", params={}, &block)
|
113
|
+
node = Gridinit::Jmeter::IfController.new(name, condition, params)
|
114
|
+
attach_node(node, &block)
|
126
115
|
end
|
127
116
|
|
128
117
|
def Loop(loops=1, params={}, &block)
|
129
118
|
node = Gridinit::Jmeter::LoopController.new(loops, params)
|
130
|
-
|
131
|
-
|
119
|
+
attach_node(node, &block)
|
120
|
+
end
|
121
|
+
|
122
|
+
def Switch(name, switch_value, params={}, &block)
|
123
|
+
node = Gridinit::Jmeter::SwitchController.new(name, switch_value, params)
|
124
|
+
attach_node(node, &block)
|
132
125
|
end
|
133
126
|
|
134
127
|
def While(condition, params={}, &block)
|
@@ -139,153 +132,170 @@ module Gridinit
|
|
139
132
|
|
140
133
|
def counter(name="counter", params={}, &block)
|
141
134
|
node = Gridinit::Jmeter::CounterConfig.new(name, params)
|
142
|
-
|
143
|
-
|
135
|
+
attach_node(node, &block)
|
136
|
+
end
|
137
|
+
|
138
|
+
def random_variable(name, min, max, params={}, &block)
|
139
|
+
node = Gridinit::Jmeter::RandomVariableConfig.new(name, min, max, params)
|
140
|
+
attach_node(node, &block)
|
141
|
+
end
|
142
|
+
|
143
|
+
def random_order(name='Random Order Controller', params={}, &block)
|
144
|
+
node = Gridinit::Jmeter::RandomOrderController.new(name, params)
|
145
|
+
attach_node(node, &block)
|
146
|
+
end
|
147
|
+
|
148
|
+
def interleave(name='Interleave Controller', params={}, &block)
|
149
|
+
node = Gridinit::Jmeter::InterleaveController.new(name, params)
|
150
|
+
attach_node(node, &block)
|
151
|
+
end
|
152
|
+
|
153
|
+
def simple(name='Simple Controller', params={}, &block)
|
154
|
+
node = Gridinit::Jmeter::SimpleController.new(name, params)
|
155
|
+
attach_node(node, &block)
|
144
156
|
end
|
145
157
|
|
146
158
|
def bsh_pre(script, params={}, &block)
|
147
159
|
node = Gridinit::Jmeter::BeanShellPreProcessor.new(script, params)
|
148
|
-
|
149
|
-
self.instance_exec(&block) if block
|
160
|
+
attach_node(node, &block)
|
150
161
|
end
|
151
162
|
|
152
163
|
def visit(name="HTTP Request", url="", params={}, &block)
|
153
|
-
params[:method]
|
164
|
+
params[:method] ||= 'GET'
|
154
165
|
node = Gridinit::Jmeter::HttpSampler.new(name, url, params)
|
155
|
-
|
156
|
-
|
166
|
+
node = Gridinit::Jmeter::HttpSampler.new(name, url, params)
|
167
|
+
attach_node(node, &block)
|
157
168
|
end
|
158
169
|
|
159
170
|
alias_method :get, :visit
|
160
171
|
|
161
172
|
def submit(name="HTTP Request", url="", params={}, &block)
|
162
|
-
params[:method]
|
163
|
-
node
|
164
|
-
|
165
|
-
self.instance_exec(&block) if block
|
173
|
+
params[:method] ||= 'POST'
|
174
|
+
node = Gridinit::Jmeter::HttpSampler.new(name, url, params)
|
175
|
+
attach_node(node, &block)
|
166
176
|
end
|
167
177
|
|
168
178
|
alias_method :post, :submit
|
169
179
|
|
180
|
+
def delete(name="HTTP Request", url="", params={}, &block)
|
181
|
+
params[:method] ||= 'DELETE'
|
182
|
+
node = Gridinit::Jmeter::HttpSampler.new(name, url, params)
|
183
|
+
attach_node(node, &block)
|
184
|
+
end
|
185
|
+
|
186
|
+
def put(name="HTTP Request", url="", params={}, &block)
|
187
|
+
params[:method] ||= 'PUT'
|
188
|
+
node = Gridinit::Jmeter::HttpSampler.new(name, url, params)
|
189
|
+
attach_node(node, &block)
|
190
|
+
end
|
191
|
+
|
170
192
|
def extract(*args, &block)
|
171
193
|
node = case args.first
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
self.instance_exec(&block) if block
|
194
|
+
when :regex
|
195
|
+
Gridinit::Jmeter::RegexExtractor.new(*args[1..-1])
|
196
|
+
when :xpath
|
197
|
+
Gridinit::Jmeter::XpathExtractor.new(*args[1..-1])
|
198
|
+
else
|
199
|
+
Gridinit::Jmeter::RegexExtractor.new(*args)
|
200
|
+
end
|
201
|
+
attach_node(node, &block)
|
181
202
|
end
|
182
203
|
|
183
204
|
alias_method :web_reg_save_param, :extract
|
184
205
|
|
185
206
|
def random_timer(delay=0, range=0, &block)
|
186
207
|
node = Gridinit::Jmeter::GaussianRandomTimer.new(delay, range)
|
187
|
-
|
188
|
-
self.instance_exec(&block) if block
|
208
|
+
attach_node(node, &block)
|
189
209
|
end
|
190
210
|
|
191
211
|
alias_method :think_time, :random_timer
|
192
212
|
|
193
213
|
def assert(match="contains", pattern="", params={}, &block)
|
194
214
|
node = Gridinit::Jmeter::ResponseAssertion.new(match, pattern, params)
|
195
|
-
|
196
|
-
self.instance_exec(&block) if block
|
215
|
+
attach_node(node, &block)
|
197
216
|
end
|
198
217
|
|
199
218
|
alias_method :web_reg_find, :assert
|
200
219
|
|
201
220
|
def view_results_full_visualizer(name="View Results Tree", params={}, &block)
|
202
221
|
node = Gridinit::Jmeter::ViewResultsFullVisualizer.new(name, params)
|
203
|
-
|
204
|
-
self.instance_exec(&block) if block
|
222
|
+
attach_node(node, &block)
|
205
223
|
end
|
206
224
|
|
207
225
|
alias_method :view_results, :view_results_full_visualizer
|
208
226
|
|
209
227
|
def table_visualizer(name="View Results in Table", params={}, &block)
|
210
228
|
node = Gridinit::Jmeter::TableVisualizer.new(name, params)
|
211
|
-
|
212
|
-
self.instance_exec(&block) if block
|
229
|
+
attach_node(node, &block)
|
213
230
|
end
|
214
231
|
|
215
232
|
def graph_visualizer(name="Graph Results", params={}, &block)
|
216
233
|
node = Gridinit::Jmeter::GraphVisualizer.new(name, params)
|
217
|
-
|
218
|
-
self.instance_exec(&block) if block
|
234
|
+
attach_node(node, &block)
|
219
235
|
end
|
220
236
|
|
221
237
|
def stat_visualizer(name="Stat Results", params={}, &block)
|
222
238
|
node = Gridinit::Jmeter::StatVisualizer.new(name, params)
|
223
|
-
|
224
|
-
self.instance_exec(&block) if block
|
239
|
+
attach_node(node, &block)
|
225
240
|
end
|
226
241
|
|
227
242
|
def simple_data_writer(name="Simple Data Writer", params={}, &block)
|
228
243
|
node = Gridinit::Jmeter::SimpleDataWriter.new(name, params)
|
229
|
-
|
230
|
-
self.instance_exec(&block) if block
|
244
|
+
attach_node(node, &block)
|
231
245
|
end
|
232
246
|
|
233
247
|
alias_method :log, :simple_data_writer
|
234
248
|
|
235
249
|
def response_time_graph_visualizer(name="Reponse Time Graph", params={}, &block)
|
236
250
|
node = Gridinit::Jmeter::ResponseTimeGraphVisualizer.new(name, params)
|
237
|
-
|
238
|
-
self.instance_exec(&block) if block
|
251
|
+
attach_node(node, &block)
|
239
252
|
end
|
240
253
|
|
241
254
|
alias_method :response_graph, :response_time_graph_visualizer
|
242
255
|
|
243
256
|
def summary_report(name="Summary Report", params={}, &block)
|
244
257
|
node = Gridinit::Jmeter::SummaryReport.new(name, params)
|
245
|
-
|
246
|
-
|
258
|
+
attach_node(node, &block)
|
259
|
+
end
|
260
|
+
|
261
|
+
def aggregate_report(name="Aggregate Report", params={}, &block)
|
262
|
+
node = Gridinit::Jmeter::AggregateReport.new(name, params)
|
263
|
+
attach_node(node, &block)
|
247
264
|
end
|
248
265
|
|
249
266
|
def ldap_ext(name="LDAPExtSampler", params={}, &block)
|
250
267
|
node = Gridinit::Jmeter::LDAPExtSampler.new(name, params)
|
251
|
-
|
252
|
-
self.instance_exec(&block) if block
|
268
|
+
attach_node(node, &block)
|
253
269
|
end
|
254
270
|
|
255
271
|
def gc_response_codes_per_second(name="jp@gc - Response Codes per Second", params={}, &block)
|
256
272
|
node = Gridinit::Jmeter::GCResponseCodesPerSecond.new(name, params)
|
257
|
-
|
258
|
-
self.instance_exec(&block) if block
|
273
|
+
attach_node(node, &block)
|
259
274
|
end
|
260
275
|
|
261
276
|
def gc_response_times_distribution(name="jp@gc - Response Times Distribution", params={}, &block)
|
262
277
|
node = Gridinit::Jmeter::GCResponseTimesDistribution.new(name, params)
|
263
|
-
|
264
|
-
self.instance_exec(&block) if block
|
278
|
+
attach_node(node, &block)
|
265
279
|
end
|
266
280
|
|
267
281
|
def gc_response_times_over_time(name="jp@gc - Response Times Over Time", params={}, &block)
|
268
282
|
node = Gridinit::Jmeter::GCResponseTimesOverTime.new(name, params)
|
269
|
-
|
270
|
-
self.instance_exec(&block) if block
|
283
|
+
attach_node(node, &block)
|
271
284
|
end
|
272
285
|
|
273
286
|
def gc_response_times_percentiles(name="jp@gc - Response Times Percentiles", params={}, &block)
|
274
287
|
node = Gridinit::Jmeter::GCResponseTimesPercentiles.new(name, params)
|
275
|
-
|
276
|
-
self.instance_exec(&block) if block
|
288
|
+
attach_node(node, &block)
|
277
289
|
end
|
278
290
|
|
279
291
|
def gc_transactions_per_second(name="jp@gc - Transactions per Second", params={}, &block)
|
280
292
|
node = Gridinit::Jmeter::GCTransactionsPerSecond.new(name, params)
|
281
|
-
|
282
|
-
self.instance_exec(&block) if block
|
293
|
+
attach_node(node, &block)
|
283
294
|
end
|
284
295
|
|
285
296
|
def gc_latencies_over_time(name="jp@gc - Response Latencies Over Time", params={}, &block)
|
286
297
|
node = Gridinit::Jmeter::GCLatenciesOverTime.new(name, params)
|
287
|
-
|
288
|
-
self.instance_exec(&block) if block
|
298
|
+
attach_node(node, &block)
|
289
299
|
end
|
290
300
|
|
291
301
|
def gc_console_status_logger(name="jp@gc - Console Status Logger", params={}, &block)
|
@@ -298,8 +308,7 @@ module Gridinit
|
|
298
308
|
|
299
309
|
def throughput_shaper(name="jp@gc - Throughput Shaping Timer", steps=[], params={}, &block)
|
300
310
|
node = Gridinit::Jmeter::ThroughputShapingTimer.new(name, steps)
|
301
|
-
|
302
|
-
self.instance_exec(&block) if block
|
311
|
+
attach_node(node, &block)
|
303
312
|
end
|
304
313
|
|
305
314
|
alias_method :shaper, :throughput_shaper
|
@@ -313,6 +322,14 @@ module Gridinit
|
|
313
322
|
logger.info "Test plan saved to: #{params[:file]}"
|
314
323
|
end
|
315
324
|
|
325
|
+
def to_xml
|
326
|
+
doc.to_xml(:indent => 2)
|
327
|
+
end
|
328
|
+
|
329
|
+
def to_doc
|
330
|
+
doc.clone
|
331
|
+
end
|
332
|
+
|
316
333
|
def run(params={})
|
317
334
|
file(params)
|
318
335
|
logger.warn "Test executing locally ..."
|
@@ -367,47 +384,19 @@ module Gridinit
|
|
367
384
|
Nokogiri::XML::Node.new("hashTree", @root)
|
368
385
|
end
|
369
386
|
|
370
|
-
def attach_to_last(node
|
371
|
-
|
372
|
-
last_node
|
373
|
-
last_node << node.doc.children <<
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
'//ThroughputController/following-sibling::hashTree'
|
384
|
-
when 'once'
|
385
|
-
'//OnceOnlyController/following-sibling::hashTree'
|
386
|
-
when 'exists'
|
387
|
-
'//IfController/following-sibling::hashTree'
|
388
|
-
when 'Loop'
|
389
|
-
'//LoopController/following-sibling::hashTree'
|
390
|
-
when 'While'
|
391
|
-
'//WhileController/following-sibling::hashTree'
|
392
|
-
when 'counter'
|
393
|
-
'//CounterConfig/following-sibling::hashTree'
|
394
|
-
when 'bsh_pre'
|
395
|
-
'//BeanShellPreProcessor/following-sibling::hashTree'
|
396
|
-
when 'visit'
|
397
|
-
'//HTTPSamplerProxy/following-sibling::hashTree'
|
398
|
-
when 'submit'
|
399
|
-
'//HTTPSamplerProxy/following-sibling::hashTree'
|
400
|
-
when 'post'
|
401
|
-
'//HTTPSamplerProxy/following-sibling::hashTree'
|
402
|
-
when 'extract'
|
403
|
-
'//RegexExtractor/following-sibling::hashTree'
|
404
|
-
when 'random_timer'
|
405
|
-
'//GaussianRandomTimer/following-sibling::hashTree'
|
406
|
-
when 'throughput_shaper'
|
407
|
-
'//kg.apc.jmeter.timers.VariableThroughputTimer/following-sibling::hashTree'
|
408
|
-
else
|
409
|
-
'//TestPlan/following-sibling::hashTree'
|
410
|
-
end
|
387
|
+
def attach_to_last(node)
|
388
|
+
ht = hash_tree
|
389
|
+
last_node = @current_node
|
390
|
+
last_node << node.doc.children << ht
|
391
|
+
ht
|
392
|
+
end
|
393
|
+
|
394
|
+
def attach_node(node, &block)
|
395
|
+
ht = attach_to_last(node)
|
396
|
+
previous = @current_node
|
397
|
+
@current_node = ht
|
398
|
+
self.instance_exec(&block) if block
|
399
|
+
@current_node = previous
|
411
400
|
end
|
412
401
|
|
413
402
|
def file(params={})
|
@@ -416,11 +405,11 @@ module Gridinit
|
|
416
405
|
end
|
417
406
|
|
418
407
|
def doc
|
419
|
-
Nokogiri::XML(@root.to_s
|
408
|
+
Nokogiri::XML(@root.to_s, &:noblanks)
|
420
409
|
end
|
421
410
|
|
422
411
|
def logger
|
423
|
-
@log
|
412
|
+
@log ||= Logger.new(STDOUT)
|
424
413
|
@log.level = Logger::DEBUG
|
425
414
|
@log
|
426
415
|
end
|
@@ -4,7 +4,16 @@ module Gridinit
|
|
4
4
|
def update(params)
|
5
5
|
params.each do |name, value|
|
6
6
|
node = @doc.children.xpath("//*[contains(@name,\"#{name.to_s}\")]")
|
7
|
-
node.first.content = value unless node.empty?
|
7
|
+
node.first.content = value unless node.empty?
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def enabled(params)
|
12
|
+
#default to true unless explicitly set to false
|
13
|
+
if params.has_key?(:enabled) && params[:enabled] == false
|
14
|
+
'false'
|
15
|
+
else
|
16
|
+
'true'
|
8
17
|
end
|
9
18
|
end
|
10
19
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Gridinit
|
2
|
+
module Jmeter
|
3
|
+
|
4
|
+
class AggregateReport
|
5
|
+
attr_accessor :doc
|
6
|
+
include Helper
|
7
|
+
|
8
|
+
def initialize(name, params={})
|
9
|
+
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
10
|
+
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
11
|
+
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
12
|
+
<objProp>
|
13
|
+
<name>saveConfig</name>
|
14
|
+
<value class="SampleSaveConfiguration">
|
15
|
+
<time>true</time>
|
16
|
+
<latency>true</latency>
|
17
|
+
<timestamp>true</timestamp>
|
18
|
+
<success>true</success>
|
19
|
+
<label>true</label>
|
20
|
+
<code>true</code>
|
21
|
+
<message>true</message>
|
22
|
+
<threadName>true</threadName>
|
23
|
+
<dataType>true</dataType>
|
24
|
+
<encoding>false</encoding>
|
25
|
+
<assertions>true</assertions>
|
26
|
+
<subresults>true</subresults>
|
27
|
+
<responseData>false</responseData>
|
28
|
+
<samplerData>false</samplerData>
|
29
|
+
<xml>false</xml>
|
30
|
+
<fieldNames>false</fieldNames>
|
31
|
+
<responseHeaders>false</responseHeaders>
|
32
|
+
<requestHeaders>false</requestHeaders>
|
33
|
+
<responseDataOnError>false</responseDataOnError>
|
34
|
+
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
|
35
|
+
<assertionsResultsToSave>0</assertionsResultsToSave>
|
36
|
+
<bytes>true</bytes>
|
37
|
+
</value>
|
38
|
+
</objProp>
|
39
|
+
<stringProp name="filename"></stringProp>
|
40
|
+
</ResultCollector>
|
41
|
+
EOF
|
42
|
+
update params
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.LatenciesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="
|
9
|
+
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.LatenciesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseCodesPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="
|
9
|
+
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseCodesPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesDistributionGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="
|
9
|
+
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesDistributionGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="
|
9
|
+
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesPercentilesGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="
|
9
|
+
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesPercentilesGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.TransactionsPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="
|
9
|
+
<kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.TransactionsPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<ResultCollector guiclass="GraphVisualizer" testclass="ResultCollector" testname="#{name}" enabled="
|
9
|
+
<ResultCollector guiclass="GraphVisualizer" testclass="ResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -7,7 +7,7 @@ module Gridinit
|
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
9
|
|
10
|
-
<ResultCollector guiclass="RespTimeGraphVisualizer" testclass="ResultCollector" testname="#{name}" enabled="
|
10
|
+
<ResultCollector guiclass="RespTimeGraphVisualizer" testclass="ResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
11
11
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
12
12
|
<objProp>
|
13
13
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="#{name}" enabled="
|
9
|
+
<ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="#{name}" enabled="
|
9
|
+
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="#{name}" enabled="
|
9
|
+
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -6,7 +6,7 @@ module Gridinit
|
|
6
6
|
include Helper
|
7
7
|
def initialize(name, params={})
|
8
8
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="#{name}" enabled="
|
9
|
+
<ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
10
10
|
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
11
11
|
<objProp>
|
12
12
|
<name>saveConfig</name>
|
@@ -4,10 +4,11 @@ module Gridinit
|
|
4
4
|
class ViewResultsFullVisualizer
|
5
5
|
attr_accessor :doc
|
6
6
|
include Helper
|
7
|
+
|
7
8
|
def initialize(name, params={})
|
8
9
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
|
-
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="#{name}" enabled="
|
10
|
-
<boolProp name="ResultCollector.error_logging"
|
10
|
+
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="#{name}" enabled="#{enabled(params)}">
|
11
|
+
<boolProp name="ResultCollector.error_logging">#{error_only(params)}</boolProp>
|
11
12
|
<objProp>
|
12
13
|
<name>saveConfig</name>
|
13
14
|
<value class="SampleSaveConfiguration">
|
@@ -40,7 +41,17 @@ module Gridinit
|
|
40
41
|
EOF
|
41
42
|
update params
|
42
43
|
end
|
43
|
-
|
44
|
+
|
45
|
+
def error_only(params)
|
46
|
+
#default to true unless explicitly set to false
|
47
|
+
if params.has_key?(:error_only) && params[:error_only] == true
|
48
|
+
'true'
|
49
|
+
else
|
50
|
+
'false'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
44
55
|
|
45
56
|
end
|
46
57
|
end
|
@@ -4,21 +4,31 @@ module Gridinit
|
|
4
4
|
class RegexExtractor
|
5
5
|
attr_accessor :doc
|
6
6
|
include Helper
|
7
|
+
|
7
8
|
def initialize(name, regex, params={})
|
8
9
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
10
|
<RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="#{name}" enabled="true">
|
10
|
-
<stringProp name="RegexExtractor.useHeaders"
|
11
|
+
<stringProp name="RegexExtractor.useHeaders">#{use_headers_type(params)}</stringProp>
|
11
12
|
<stringProp name="RegexExtractor.refname">#{name}</stringProp>
|
12
13
|
<stringProp name="RegexExtractor.regex">#{CGI.escapeHTML regex}</stringProp>
|
13
14
|
<stringProp name="RegexExtractor.template">$1$</stringProp>
|
14
|
-
<stringProp name="RegexExtractor.default"
|
15
|
+
<stringProp name="RegexExtractor.default">#{params[:default]}</stringProp>
|
15
16
|
<stringProp name="RegexExtractor.match_number">0</stringProp>
|
16
17
|
<stringProp name="Sample.scope">all</stringProp>
|
17
18
|
</RegexExtractor>
|
18
19
|
EOF
|
19
20
|
update params
|
20
21
|
end
|
21
|
-
|
22
|
+
|
23
|
+
def use_headers_type(params)
|
24
|
+
#default to true unless explicitly set to false
|
25
|
+
if params.has_key?(:match_on)
|
26
|
+
params[:match_on]
|
27
|
+
else
|
28
|
+
'false'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
22
32
|
|
23
33
|
end
|
24
34
|
end
|
@@ -10,7 +10,9 @@ module Gridinit
|
|
10
10
|
<stringProp name="filename"></stringProp>
|
11
11
|
<stringProp name="parameters"></stringProp>
|
12
12
|
<boolProp name="resetInterpreter">false</boolProp>
|
13
|
-
<stringProp name="script"
|
13
|
+
<stringProp name="script"><![CDATA[
|
14
|
+
#{script}
|
15
|
+
]]></stringProp>
|
14
16
|
</BeanShellPreProcessor>
|
15
17
|
EOF
|
16
18
|
update params
|
@@ -5,6 +5,7 @@ module Gridinit
|
|
5
5
|
attr_accessor :doc
|
6
6
|
include Helper
|
7
7
|
def initialize(num_threads, params={})
|
8
|
+
params[:ramp_time] ||= num_threads/2
|
8
9
|
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
|
9
10
|
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
|
10
11
|
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
|
@@ -13,7 +14,7 @@ module Gridinit
|
|
13
14
|
<stringProp name="LoopController.loops">1</stringProp>
|
14
15
|
</elementProp>
|
15
16
|
<stringProp name="ThreadGroup.num_threads">#{num_threads}</stringProp>
|
16
|
-
<stringProp name="ThreadGroup.ramp_time"
|
17
|
+
<stringProp name="ThreadGroup.ramp_time">#{params[:ramp_time]}</stringProp>
|
17
18
|
<longProp name="ThreadGroup.start_time">1352677419000</longProp>
|
18
19
|
<longProp name="ThreadGroup.end_time">1352677419000</longProp>
|
19
20
|
<boolProp name="ThreadGroup.scheduler">false</boolProp>
|
data/spec/dsl_spec.rb
CHANGED
@@ -21,15 +21,138 @@ describe "DSL" do
|
|
21
21
|
it "should output a test plan to stdout" do
|
22
22
|
$stdout.should_receive(:puts).with(/jmeterTestPlan/i)
|
23
23
|
test do
|
24
|
-
end.
|
24
|
+
end.out
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should output a test plan to jmx file" do
|
28
28
|
file = mock('file')
|
29
|
-
File.should_receive(:open).with("
|
29
|
+
File.should_receive(:open).with("jmeter.jmx", "w").and_yield(file)
|
30
30
|
file.should_receive(:write).with(/jmeterTestPlan/i)
|
31
31
|
test do
|
32
32
|
end.jmx
|
33
33
|
end
|
34
34
|
|
35
|
+
describe 'Disabled reports' do
|
36
|
+
let(:doc) do
|
37
|
+
test do
|
38
|
+
aggregate_report('Aggregate Report disabled', {enabled: false})
|
39
|
+
aggregate_report('Aggregate Report enabled', {enabled: true})
|
40
|
+
aggregate_report('Aggregate Report default', {enabled: true})
|
41
|
+
end.to_doc
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:aggregate_report_disabled) { doc.search("//ResultCollector[@testname='Aggregate Report disabled']").first }
|
45
|
+
let(:aggregate_report_enabled) { doc.search("//ResultCollector[@testname='Aggregate Report enabled']").first }
|
46
|
+
let(:aggregate_report_default) { doc.search("//ResultCollector[@testname='Aggregate Report default']").first }
|
47
|
+
|
48
|
+
it 'should disable Aggregate Report disabled' do
|
49
|
+
aggregate_report_disabled.attributes['enabled'].value.should == 'false'
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should disable Aggregate Report enabled' do
|
53
|
+
aggregate_report_enabled.attributes['enabled'].value.should == 'true'
|
54
|
+
end
|
55
|
+
it 'should disable Aggregate Report default' do
|
56
|
+
aggregate_report_enabled.attributes['enabled'].value.should == 'true'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe do
|
61
|
+
|
62
|
+
let(:doc) do
|
63
|
+
test do
|
64
|
+
view_results_full_visualizer('View Results Tree error_only', {error_only: true})
|
65
|
+
view_results_full_visualizer('View Results Tree not error_only', {error_only: false})
|
66
|
+
view_results_full_visualizer('View Results Tree default')
|
67
|
+
end.to_doc
|
68
|
+
end
|
69
|
+
|
70
|
+
let(:report_errors_only) { doc.search("//ResultCollector[@testname='View Results Tree error_only']").first }
|
71
|
+
let(:report_not_errors_only) { doc.search("//ResultCollector[@testname='View Results Tree not error_only']").first }
|
72
|
+
let(:report_default) { doc.search("//ResultCollector[@testname='View Results Tree default']").first }
|
73
|
+
|
74
|
+
it 'should be true when errors only' do
|
75
|
+
error_logging = report_errors_only.children.first
|
76
|
+
error_logging.attributes['name'].value.should == 'ResultCollector.error_logging'
|
77
|
+
error_logging.text.should == 'true'
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should be false when not errors only' do
|
81
|
+
error_logging = report_not_errors_only.children.first
|
82
|
+
error_logging.attributes['name'].value.should == 'ResultCollector.error_logging'
|
83
|
+
error_logging.text.should == 'false'
|
84
|
+
end
|
85
|
+
it 'should default to false when not given' do
|
86
|
+
error_logging = report_default.children.first
|
87
|
+
error_logging.attributes['name'].value.should == 'ResultCollector.error_logging'
|
88
|
+
error_logging.text.should == 'false'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe 'extract use_headers_type' do
|
93
|
+
|
94
|
+
let(:doc) do
|
95
|
+
test do
|
96
|
+
extract :regex, 'match on url', 'blah', {match_on: 'URL'}
|
97
|
+
extract :regex, 'match on default', 'blah'
|
98
|
+
end.to_doc
|
99
|
+
end
|
100
|
+
|
101
|
+
let(:extract_url) { doc.search("//RegexExtractor[@testname='match on url']").first }
|
102
|
+
let(:extract) { doc.search("//RegexExtractor[@testname='match on default']").first }
|
103
|
+
|
104
|
+
it 'should match on URL' do
|
105
|
+
extract_url.search(".//stringProp[@name='RegexExtractor.useHeaders']").text.should == 'URL'
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should default to false' do
|
109
|
+
extract.search(".//stringProp[@name='RegexExtractor.useHeaders']").text.should == 'false'
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
describe 'Nested controllers' do
|
115
|
+
|
116
|
+
let(:doc) do
|
117
|
+
test do
|
118
|
+
simple 'blah1.1' do
|
119
|
+
simple 'blah2.1'
|
120
|
+
simple 'blah2.2' do
|
121
|
+
simple 'blah3.1'
|
122
|
+
end
|
123
|
+
simple 'blah2.3'
|
124
|
+
end
|
125
|
+
simple 'blah1.2'
|
126
|
+
end.to_doc
|
127
|
+
end
|
128
|
+
|
129
|
+
let(:blah1_1) { doc.search("//GenericController[@testname='blah1.1']").first }
|
130
|
+
let(:blah1_2) { doc.search("//GenericController[@testname='blah1.2']").first }
|
131
|
+
|
132
|
+
let(:blah2_1) { doc.search("//GenericController[@testname='blah2.1']").first }
|
133
|
+
let(:blah2_2) { doc.search("//GenericController[@testname='blah2.2']").first }
|
134
|
+
let(:blah2_3) { doc.search("//GenericController[@testname='blah2.3']").first }
|
135
|
+
|
136
|
+
let(:blah3_1) { doc.search("//GenericController[@testname='blah3.1']").first }
|
137
|
+
|
138
|
+
it 'nodes should have hashTree as its parent' do
|
139
|
+
[blah1_1, blah1_2, blah2_1, blah2_2, blah2_3, blah3_1].each do |node|
|
140
|
+
node.parent.name.should == 'hashTree'
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe 'blah3_1' do
|
145
|
+
it 'parent parent should be blah2_2' do
|
146
|
+
blah3_1.parent.should == blah2_2.next
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe 'blah1_2' do
|
151
|
+
it 'previous non hashTree sibling is blah1_1' do
|
152
|
+
blah1_2.previous.previous.should == blah1_1
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
35
158
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gridinit-jmeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
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-04-
|
12
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -53,7 +53,6 @@ extra_rdoc_files: []
|
|
53
53
|
files:
|
54
54
|
- .gitattributes
|
55
55
|
- .gitignore
|
56
|
-
- .rbenv-version
|
57
56
|
- .rspec
|
58
57
|
- .travis.yml
|
59
58
|
- Gemfile
|
@@ -93,11 +92,16 @@ files:
|
|
93
92
|
- lib/gridinit-jmeter/config/cookie_manager.rb
|
94
93
|
- lib/gridinit-jmeter/config/counter_config.rb
|
95
94
|
- lib/gridinit-jmeter/config/header_manager.rb
|
95
|
+
- lib/gridinit-jmeter/config/random_variable.rb
|
96
96
|
- lib/gridinit-jmeter/config/request_defaults.rb
|
97
97
|
- lib/gridinit-jmeter/config/user_defined_variable.rb
|
98
98
|
- lib/gridinit-jmeter/controllers/if_controller.rb
|
99
|
+
- lib/gridinit-jmeter/controllers/interleave.rb
|
99
100
|
- lib/gridinit-jmeter/controllers/loop_controller.rb
|
100
101
|
- lib/gridinit-jmeter/controllers/once_only.rb
|
102
|
+
- lib/gridinit-jmeter/controllers/random_order.rb
|
103
|
+
- lib/gridinit-jmeter/controllers/simple.rb
|
104
|
+
- lib/gridinit-jmeter/controllers/switch.rb
|
101
105
|
- lib/gridinit-jmeter/controllers/throughput.rb
|
102
106
|
- lib/gridinit-jmeter/controllers/transaction.rb
|
103
107
|
- lib/gridinit-jmeter/controllers/while_controller.rb
|
@@ -108,6 +112,7 @@ files:
|
|
108
112
|
- lib/gridinit-jmeter/helpers/logger-colors.rb
|
109
113
|
- lib/gridinit-jmeter/helpers/strip-heredoc.rb
|
110
114
|
- lib/gridinit-jmeter/helpers/user-agents.rb
|
115
|
+
- lib/gridinit-jmeter/listeners/aggregate_report.rb
|
111
116
|
- lib/gridinit-jmeter/listeners/gc_console_status_logger.rb
|
112
117
|
- lib/gridinit-jmeter/listeners/gc_latencies_over_time.rb
|
113
118
|
- lib/gridinit-jmeter/listeners/gc_response_codes_per_second.rb
|
@@ -159,7 +164,4 @@ rubygems_version: 1.8.23
|
|
159
164
|
signing_key:
|
160
165
|
specification_version: 3
|
161
166
|
summary: This is a Ruby based DSL for writing JMeter test plans
|
162
|
-
test_files:
|
163
|
-
- spec/dsl_spec.rb
|
164
|
-
- spec/spec_helper.rb
|
165
|
-
- spec/stub.rb
|
167
|
+
test_files: []
|
data/.rbenv-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.9.3-p385
|