ruby-jmeter 2.13.10 → 3.0.0

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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +1 -1
  5. data/Gemfile +2 -2
  6. data/LICENSE.txt +2 -2
  7. data/README.md +4 -5
  8. data/Rakefile +3 -3
  9. data/examples/{basic_os_process_sampler.rb → OS_process_sampler.rb} +1 -1
  10. data/examples/{basic_assertion_results.rb → assertion_results.rb} +1 -3
  11. data/examples/basic_auth.rb +1 -1
  12. data/examples/{basic_browser_headers.rb → browser_headers.rb} +1 -1
  13. data/examples/{basic_composite_graph.rb → composite_graph.rb} +1 -1
  14. data/examples/{basic_gc_dummy_sampler.rb → dummy_sampler.rb} +1 -3
  15. data/examples/{basic_duration_assertion.rb → duration_assertion.rb} +1 -1
  16. data/examples/etsy_login_browse.rb +1 -4
  17. data/examples/{basic_extract.rb → extract.rb} +1 -1
  18. data/examples/{basic_foreach.rb → foreach_controller.rb} +1 -4
  19. data/examples/{basic_header.rb → header_manager.rb} +2 -3
  20. data/examples/{basic_cache.rb → http_cache_manager.rb} +1 -1
  21. data/examples/{basic_cookies.rb → http_cookie_manager.rb} +1 -1
  22. data/examples/{basic_http_request_defaults.rb → http_request_defaults.rb} +3 -2
  23. data/examples/{basic_post.rb → http_request_post.rb} +1 -5
  24. data/examples/{basic_http_request_with_files.rb → http_request_with_files.rb} +1 -1
  25. data/examples/{basic_query_params.rb → http_request_with_query_params.rb} +1 -1
  26. data/examples/{basic_gc_results.rb → jmeter_plugins_graphs.rb} +1 -2
  27. data/examples/{basic_json_path_assertion.rb → json_path_assertions.rb} +1 -1
  28. data/examples/{basic_json_path_extractor.rb → json_path_extractor.rb} +1 -3
  29. data/examples/{basic_ldap_ext.rb → ldap_sampler.rb} +1 -1
  30. data/examples/{basic_loadosophia.rb → loadosophia.rb} +1 -1
  31. data/examples/{basic_loops.rb → loop_controller.rb} +2 -2
  32. data/examples/{basic_counter.rb → loops_with_counter.rb} +2 -2
  33. data/examples/{basic_perfmon.rb → perfmon.rb} +1 -1
  34. data/examples/real_page_objects.rb +1 -1
  35. data/examples/real_user_objects_github.rb +1 -1
  36. data/examples/regular_expression_extractor.rb +11 -0
  37. data/examples/{basic_assertion.rb → response_assertion.rb} +2 -1
  38. data/examples/{basic_response_time_percentiles_graph.rb → response_time_percentiles_graph.rb} +1 -2
  39. data/examples/{basic_simple_data_writer.rb → simple_data_writer_listener.rb} +1 -1
  40. data/examples/{basic_stepping_thread_group.rb → stepping_thread_group.rb} +1 -3
  41. data/examples/{basic_test_fragment.rb → test_fragment.rb} +1 -1
  42. data/examples/{basic_think_time.rb → think_time.rb} +2 -2
  43. data/examples/{basic_thread_groups.rb → thread_groups.rb} +1 -1
  44. data/examples/{basic_throughput_controller.rb → throughput_controller.rb} +1 -1
  45. data/examples/{basic_throughput_shaping_timer.rb → throughput_shaping_timer.rb} +1 -2
  46. data/examples/{basic_ultimate_thread_group.rb → ultimate_thread_group.rb} +1 -2
  47. data/examples/{basic_user_defined_variables.rb → user_defined_variables.rb} +1 -1
  48. data/examples/{basic_preprocessor_user_parameters.rb → user_parameters.rb} +7 -7
  49. data/lib/ruby-jmeter.rb +13 -8
  50. data/lib/ruby-jmeter/DSL.md +3 -1
  51. data/lib/ruby-jmeter/dsl.rb +11 -615
  52. data/lib/ruby-jmeter/dsl/foreach_controller.rb +0 -2
  53. data/lib/ruby-jmeter/dsl/html_parameter_mask.rb +3 -3
  54. data/lib/ruby-jmeter/dsl/http_request.rb +0 -2
  55. data/lib/ruby-jmeter/dsl/http_request_defaults.rb +0 -1
  56. data/lib/ruby-jmeter/dsl/jms_publisher.rb +2 -0
  57. data/lib/ruby-jmeter/dsl/regular_expression_extractor.rb +1 -3
  58. data/lib/ruby-jmeter/dsl/response_assertion.rb +0 -1
  59. data/lib/ruby-jmeter/dsl/test_fragment.rb +1 -1
  60. data/lib/ruby-jmeter/dsl/user_parameters.rb +3 -1
  61. data/lib/ruby-jmeter/extend/assertions/response_assertion.rb +36 -0
  62. data/lib/ruby-jmeter/extend/config_elements/header_manager.rb +13 -0
  63. data/lib/ruby-jmeter/extend/config_elements/http_cache_manager.rb +11 -0
  64. data/lib/ruby-jmeter/extend/config_elements/http_cookie_manager.rb +11 -0
  65. data/lib/ruby-jmeter/extend/config_elements/http_request_defaults.rb +28 -0
  66. data/lib/ruby-jmeter/extend/config_elements/user_defined_variables.rb +13 -0
  67. data/lib/ruby-jmeter/extend/config_elements/user_parameters.rb +31 -0
  68. data/lib/ruby-jmeter/extend/controllers/foreach_controller.rb +25 -0
  69. data/lib/ruby-jmeter/extend/controllers/loop_controller.rb +11 -0
  70. data/lib/ruby-jmeter/extend/controllers/module_controller.rb +23 -0
  71. data/lib/ruby-jmeter/extend/controllers/throughput_controller.rb +15 -0
  72. data/lib/ruby-jmeter/extend/controllers/transaction_controller.rb +14 -0
  73. data/lib/ruby-jmeter/extend/misc/aliases.rb +21 -0
  74. data/lib/ruby-jmeter/extend/misc/exists.rb +13 -0
  75. data/lib/ruby-jmeter/extend/misc/flood.rb +48 -0
  76. data/lib/ruby-jmeter/extend/misc/with_helpers.rb +27 -0
  77. data/lib/ruby-jmeter/extend/plugins/jmeter_plugins.rb +115 -0
  78. data/lib/ruby-jmeter/extend/processors/extract.rb +28 -0
  79. data/lib/ruby-jmeter/extend/processors/regular_expression_extractor.rb +25 -0
  80. data/lib/ruby-jmeter/extend/samplers/http_request.rb +47 -0
  81. data/lib/ruby-jmeter/extend/samplers/soapxmlrpc_request.rb +9 -0
  82. data/lib/ruby-jmeter/extend/threads/setup_thread_group.rb +18 -0
  83. data/lib/ruby-jmeter/extend/threads/thread_group.rb +19 -0
  84. data/lib/ruby-jmeter/extend/timers/constant_throughput_timer.rb +12 -0
  85. data/lib/ruby-jmeter/extend/timers/random_timer.rb +14 -0
  86. data/lib/ruby-jmeter/helpers/helper.rb +1 -2
  87. data/lib/ruby-jmeter/idl.xml +6 -4
  88. data/lib/ruby-jmeter/version.rb +1 -1
  89. data/ruby-jmeter.gemspec +7 -7
  90. data/spec/constant_throughput_timer_spec.rb +22 -0
  91. data/spec/header_manager_spec.rb +37 -0
  92. data/spec/http_cache_manager_spec.rb +17 -0
  93. data/spec/http_cookie_manager_spec.rb +17 -0
  94. data/spec/http_request_defaults_spec.rb +47 -0
  95. data/spec/http_request_spec.rb +305 -0
  96. data/spec/jmeter_plugins_spec.rb +155 -0
  97. data/spec/json_extractor_spec.rb +19 -0
  98. data/spec/json_path_assertion_spec.rb +28 -0
  99. data/spec/logic_controller_spec.rb +148 -0
  100. data/spec/loop_controller_spec.rb +19 -0
  101. data/spec/module_controller_spec.rb +56 -0
  102. data/spec/regular_expression_extractor_spec.rb +63 -0
  103. data/spec/response_assertion_spec.rb +69 -0
  104. data/spec/setup_thread_group_spec.rb +31 -0
  105. data/spec/thread_group_spec.rb +57 -0
  106. data/spec/throughput_controller_spec.rb +24 -0
  107. data/spec/transaction_controller_spec.rb +30 -0
  108. data/spec/user_defined_variables_spec.rb +22 -0
  109. data/spec/user_parameters_spec.rb +45 -0
  110. data/spec/with_helpers_spec.rb +57 -0
  111. data/spec/xpath_extractor_spec.rb +15 -0
  112. metadata +87 -59
  113. data/examples/basic_flood.rb +0 -12
  114. data/examples/basic_flood_real.rb +0 -7
  115. data/examples/basic_flood_with_csv.rb +0 -16
  116. data/examples/basic_google.rb +0 -8
  117. data/examples/basic_har.json +0 -4252
  118. data/examples/basic_har.rb +0 -34
  119. data/examples/basic_meta_fu.rb +0 -63
  120. data/examples/basic_response_assertion.rb +0 -13
  121. data/examples/basic_run.rb +0 -12
  122. data/examples/basic_testdata.rb +0 -60
  123. data/examples/demo.csv +0 -3
  124. data/examples/real_flood_test.rb +0 -14
  125. data/examples/real_flood_test_data.rb +0 -15
  126. data/examples/real_immi.gov.au_visa.rb +0 -78
  127. data/lib/ruby-jmeter/helpers/jmeter.properties +0 -28
  128. data/spec/dsl_spec.rb +0 -1157
  129. data/spec/stub.rb +0 -31
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'http_cache_manager' do
4
+ describe 'the clear_each_iteration option should be respected' do
5
+ let(:doc) do
6
+ test do
7
+ cache clear_each_iteration: true
8
+ end.to_doc
9
+ end
10
+
11
+ let(:cache_fragment) { doc.search("//CacheManager") }
12
+
13
+ it 'should match on clearEachIteration' do
14
+ expect(cache_fragment.search(".//boolProp[@name='clearEachIteration']").first.text).to eq 'true'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'http_cookie_manager' do
4
+ describe 'the clear_each_iteration option should be respected' do
5
+ let(:doc) do
6
+ test do
7
+ cookies clear_each_iteration: true
8
+ end.to_doc
9
+ end
10
+
11
+ let(:cookies_fragment) { doc.search("//CookieManager") }
12
+
13
+ it 'should match on clearEachIteration' do
14
+ expect(cookies_fragment.search(".//boolProp[@name='CookieManager.clearEachIteration']").first.text).to eq'true'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'regular_expression_extractor' do
4
+ describe 'standard scope' do
5
+ let(:doc) do
6
+ test do
7
+ defaults domain: 'example.com',
8
+ protocol: 'https',
9
+ implementation: 'HttpClient3.1',
10
+ download_resources: true,
11
+ use_concurrent_pool: 5,
12
+ urls_must_match: 'http.+?example.com'
13
+ end.to_doc
14
+ end
15
+
16
+ let(:config_fragment) { doc.search('//ConfigTestElement').first }
17
+ let(:sampler_fragment) { doc.search('//HTTPSamplerProxy').first }
18
+
19
+ it 'matches on domain' do
20
+ expect(config_fragment.search(".//stringProp[@name='HTTPSampler.domain']").text).to eq 'example.com'
21
+ end
22
+
23
+ it 'matches on protocol' do
24
+ expect(config_fragment.search(".//stringProp[@name='HTTPSampler.protocol']").text).to eq 'https'
25
+ end
26
+
27
+ it 'matches on implementation' do
28
+ expect(config_fragment.search(".//stringProp[@name='HTTPSampler.implementation']").text).to eq 'HttpClient3.1'
29
+ end
30
+
31
+ it 'matches on image_parser' do
32
+ expect(config_fragment.search(".//boolProp[@name='HTTPSampler.image_parser']").text).to eq 'true'
33
+ end
34
+
35
+ it 'matches on concurrent download' do
36
+ expect(config_fragment.search(".//boolProp[@name='HTTPSampler.concurrentDwn']").text).to eq 'true'
37
+ end
38
+
39
+ it 'matches on concurrent pool' do
40
+ expect(config_fragment.search(".//stringProp[@name='HTTPSampler.concurrentPool']").text).to eq '5'
41
+ end
42
+
43
+ it 'matches on embedded url regex' do
44
+ expect(config_fragment.search(".//stringProp[@name='HTTPSampler.embedded_url_re']").text).to eq 'http.+?example.com'
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,305 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'http_request' do
4
+ describe 'get basic' do
5
+ let(:doc) do
6
+ test do
7
+ threads count: 1 do
8
+ get name: 'Home Page', url: 'http://google.com/'
9
+ end
10
+ end.to_doc
11
+ end
12
+
13
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
14
+
15
+ it 'matches on method' do
16
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.method']").text).to eq 'GET'
17
+ end
18
+
19
+ it 'matches on domain' do
20
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.domain']").text).to eq 'google.com'
21
+ end
22
+
23
+ it 'matches on port' do
24
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.port']").text).to eq '80'
25
+ end
26
+
27
+ it 'matches on protocol' do
28
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.protocol']").text).to eq 'http'
29
+ end
30
+
31
+ it 'matches on path' do
32
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.path']").text).to eq '/'
33
+ end
34
+ end
35
+
36
+ describe 'get with options' do
37
+ let(:doc) do
38
+ test do
39
+ threads count: 1 do
40
+ get name: 'Home Page', url: 'http://google.com/', follow_redirects: false, use_keepalive: false
41
+ end
42
+ end.to_doc
43
+ end
44
+
45
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
46
+
47
+ it 'matches on domain' do
48
+ expect(fragment.search(".//boolProp[@name='HTTPSampler.follow_redirects']").text).to eq 'false'
49
+ end
50
+
51
+ it 'matches on port' do
52
+ expect(fragment.search(".//boolProp[@name='HTTPSampler.use_keepalive']").text).to eq 'false'
53
+ end
54
+ end
55
+
56
+ describe 'visit' do
57
+ let(:doc) do
58
+ test do
59
+ threads count: 1 do
60
+ visit name: 'Home Page', url: 'http://google.com/'
61
+ end
62
+ end.to_doc
63
+ end
64
+
65
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
66
+
67
+ it 'matches on method' do
68
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.method']").text).to eq 'GET'
69
+ end
70
+ end
71
+
72
+ describe 'visit variations' do
73
+ let(:doc) do
74
+ test do
75
+ threads do
76
+ visit url: "/home?location=melbourne&location=sydney", always_encode: true
77
+ end
78
+ end.to_doc
79
+ end
80
+
81
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
82
+
83
+ it 'should match on path' do
84
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.path']").text).to eq '/home'
85
+ end
86
+
87
+ context 'first argument' do
88
+ it 'should match on always_encode' do
89
+ expect(fragment.search(".//boolProp[@name='HTTPArgument.always_encode']")[0].text).to eq 'true'
90
+ end
91
+
92
+ it 'should match on query param name: location' do
93
+ expect(fragment.search(".//stringProp[@name='Argument.name']")[0].text).to eq 'location'
94
+ end
95
+
96
+ it 'should match on query param value: melbourne' do
97
+ expect(fragment.search(".//stringProp[@name='Argument.value']")[0].text).to eq 'melbourne'
98
+ end
99
+ end
100
+
101
+ context 'second argument' do
102
+ it 'should match on always_encode' do
103
+ expect(fragment.search(".//boolProp[@name='HTTPArgument.always_encode']")[1].text).to eq 'true'
104
+ end
105
+
106
+ it 'should match on query param name: location' do
107
+ expect(fragment.search(".//stringProp[@name='Argument.name']")[1].text).to eq 'location'
108
+ end
109
+
110
+ it 'should match on query param value: sydney' do
111
+ expect(fragment.search(".//stringProp[@name='Argument.value']")[1].text).to eq 'sydney'
112
+ end
113
+ end
114
+ end
115
+
116
+ describe 'visit old syntax' do
117
+ let(:doc) do
118
+ test do
119
+ threads do
120
+ visit "/home?location=melbourne", always_encode: true
121
+ end
122
+ end.to_doc
123
+ end
124
+
125
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
126
+
127
+ it 'should match on path' do
128
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.path']").text).to eq '/home'
129
+ end
130
+ end
131
+
132
+ describe 'https' do
133
+ let(:doc) do
134
+ test do
135
+ threads do
136
+ visit url: "https://example.com"
137
+ end
138
+ end.to_doc
139
+ end
140
+
141
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
142
+
143
+ it 'should match on protocol' do
144
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.protocol']").text).to eq 'https'
145
+ end
146
+ end
147
+
148
+ describe 'post' do
149
+ let(:doc) do
150
+ test do
151
+ threads count: 1 do
152
+ post name: 'Home Page', url: 'http://google.com/'
153
+ end
154
+ end.to_doc
155
+ end
156
+
157
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
158
+
159
+ it 'matches on method' do
160
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.method']").text).to eq 'POST'
161
+ end
162
+ end
163
+
164
+ describe 'post raw_path' do
165
+ let(:doc) do
166
+ test do
167
+ threads do
168
+ transaction name: "TC_02" do
169
+ post url: "/home?location=melbourne", raw_path: true
170
+ end
171
+ end
172
+ end.to_doc
173
+ end
174
+
175
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
176
+
177
+ it 'should match on path' do
178
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.path']").text).to eq '/home?location=melbourne'
179
+ end
180
+ end
181
+
182
+ describe 'post raw body containing xml entities' do
183
+ let(:doc) do
184
+ test do
185
+ threads do
186
+ post url: 'http://example.com', raw_body: 'username=my_name&password=my_password&email="my name <test@example.com>"'
187
+ end
188
+ end.to_doc
189
+ end
190
+
191
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
192
+
193
+ it 'escape raw_body' do
194
+ expect(fragment.search(".//stringProp[@name='Argument.value']").text).to eq 'username=my_name&password=my_password&email="my name <test@example.com>"'
195
+ end
196
+ end
197
+
198
+ describe 'submit' do
199
+ let(:doc) do
200
+ test do
201
+ threads count: 1 do
202
+ submit name: 'Home Page', url: 'http://google.com/'
203
+ end
204
+ end.to_doc
205
+ end
206
+
207
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
208
+
209
+ it 'matches on method' do
210
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.method']").text).to eq 'POST'
211
+ end
212
+ end
213
+
214
+ describe 'submit variations' do
215
+ let(:doc) do
216
+ test do
217
+ threads do
218
+ submit url: '/', fill_in: { username: 'tim', password: 'password' }
219
+ end
220
+ end.to_doc
221
+ end
222
+
223
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
224
+
225
+ it 'should match on POST' do
226
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.method']").text).to eq 'POST'
227
+ end
228
+
229
+ it 'should have no files' do
230
+ expect(fragment.search(".//elementProp[@name='HTTPsampler.Files']").length).to eq 0
231
+ end
232
+ end
233
+
234
+ describe 'submit_with_files' do
235
+ let(:doc) do
236
+ test do
237
+ threads do
238
+ transaction name: "TC_03", parent: true, include_timers: true do
239
+ submit url: "/", fill_in: { username: 'tim', password: 'password' },
240
+ files: [{path: '/tmp/foo', paramname: 'fileup', mimetype: 'text/plain'},
241
+ {path: '/tmp/bar', paramname: 'otherfileup'}]
242
+ end
243
+ end
244
+ end.to_doc
245
+ end
246
+
247
+ let(:fragment) { doc.search("//HTTPSamplerProxy/elementProp[@name='HTTPsampler.Files']").first }
248
+
249
+ it 'should have two files' do
250
+ expect(fragment.search("./collectionProp/elementProp[@elementType='HTTPFileArg']").length).to eq 2
251
+ end
252
+
253
+ it 'should have one empty mimetype' do
254
+ expect(fragment.search("./collectionProp/elementProp[@elementType='HTTPFileArg']/stringProp[@name='File.mimetype' and normalize-space(.) = '']").length).to eq 1
255
+ end
256
+ end
257
+
258
+ describe 'patch' do
259
+ let(:doc) do
260
+ test do
261
+ threads count: 1 do
262
+ patch name: 'Home Page', url: 'http://google.com/'
263
+ end
264
+ end.to_doc
265
+ end
266
+
267
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
268
+
269
+ it 'matches on method' do
270
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.method']").text).to eq 'PATCH'
271
+ end
272
+ end
273
+
274
+ describe 'head' do
275
+ let(:doc) do
276
+ test do
277
+ threads count: 1 do
278
+ head name: 'Home Page', url: 'http://google.com/'
279
+ end
280
+ end.to_doc
281
+ end
282
+
283
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
284
+
285
+ it 'matches on method' do
286
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.method']").text).to eq 'HEAD'
287
+ end
288
+ end
289
+
290
+ describe 'put' do
291
+ let(:doc) do
292
+ test do
293
+ threads count: 1 do
294
+ put name: 'Home Page', url: 'http://google.com/'
295
+ end
296
+ end.to_doc
297
+ end
298
+
299
+ let(:fragment) { doc.search('//HTTPSamplerProxy').first }
300
+
301
+ it 'matches on method' do
302
+ expect(fragment.search(".//stringProp[@name='HTTPSampler.method']").text).to eq 'PUT'
303
+ end
304
+ end
305
+ end
@@ -0,0 +1,155 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'stepping thread group' do
4
+ let(:doc) do
5
+ test do
6
+ stepping_thread_group on_sample_error: 'startnextloop', total_threads: 100, initial_delay: 1, start_threads: 2, add_threads: 3, start_every: 4, stop_threads: 5, stop_every: 6, flight_time: 7, rampup: 8
7
+ end.to_doc
8
+ end
9
+
10
+ let(:fragment) { doc.search("//kg.apc.jmeter.threads.SteppingThreadGroup").first }
11
+ it 'should match on on_sample_error' do
12
+ expect(fragment.search(".//stringProp[@name='ThreadGroup.on_sample_error']").text).to eq 'startnextloop'
13
+ end
14
+
15
+ it 'should match on total_threads' do
16
+ expect(fragment.search(".//stringProp[@name='ThreadGroup.num_threads']").text).to eq '100'
17
+ end
18
+
19
+ it 'should match on initial_delay' do
20
+ expect(fragment.search(".//stringProp[@name='Threads initial delay']").text).to eq '1'
21
+ end
22
+
23
+ it 'should match on start_threads' do
24
+ expect(fragment.search(".//stringProp[@name='Start users count']").text).to eq '2'
25
+ end
26
+
27
+ it 'should match on add_threads' do
28
+ expect(fragment.search(".//stringProp[@name='Start users count burst']").text).to eq '3'
29
+ end
30
+
31
+ it 'should match on start_every' do
32
+ expect(fragment.search(".//stringProp[@name='Start users period']").text).to eq '4'
33
+ end
34
+
35
+ it 'should match on stop_threads' do
36
+ expect(fragment.search(".//stringProp[@name='Stop users count']").text).to eq '5'
37
+ end
38
+
39
+ it 'should match on stop_every' do
40
+ expect(fragment.search(".//stringProp[@name='Stop users period']").text).to eq '6'
41
+ end
42
+
43
+ it 'should match on flight_time' do
44
+ expect(fragment.search(".//stringProp[@name='flighttime']").text).to eq '7'
45
+ end
46
+
47
+ it 'should match on rampup' do
48
+ expect(fragment.search(".//stringProp[@name='rampUp']").text).to eq '8'
49
+ end
50
+ end
51
+
52
+ describe 'dummy sampler' do
53
+ let(:doc) do
54
+ test do
55
+ threads do
56
+ dummy_sampler 'dummy sampler name', { RESPONSE_DATA: "Some response data" }
57
+ end
58
+ end.to_doc
59
+ end
60
+
61
+ let(:fragment) { doc.search("//kg.apc.jmeter.samplers.DummySampler").first }
62
+
63
+ it 'should match on name' do
64
+ expect(fragment.attributes['testname'].value).to eq 'dummy sampler name'
65
+ end
66
+
67
+ it 'should match on response data' do
68
+ expect(fragment.search("//stringProp[@name='RESPONSE_DATA']").text).to eq 'Some response data'
69
+ end
70
+ end
71
+
72
+ describe 'perfmon collector' do
73
+ let(:doc) do
74
+ test do
75
+ threads do
76
+ perfmon_collector name: 'perfmon collector name',
77
+ nodes:
78
+ [
79
+ {server: '1.1.1.1', port: 4444, metric: 'CPU', parameters: ''},
80
+ {server: '2.2.2.2', port: 4444, metric: 'CPU', parameters: ''}
81
+ ],
82
+ filename: 'perf.jtl',
83
+ xml: false
84
+ end
85
+ end.to_doc
86
+ end
87
+
88
+ let(:fragment) { doc.search("//kg.apc.jmeter.perfmon.PerfMonCollector").first }
89
+ let(:metric_connections) { fragment.search("//collectionProp[@name='metricConnections']").first }
90
+
91
+ it 'should match on name' do
92
+ expect(fragment.attributes['testname'].value).to eq 'perfmon collector name'
93
+ end
94
+
95
+ it 'should match on xml flag' do
96
+ expect(fragment.search(".//xml").first.text).to eq 'false'
97
+ end
98
+
99
+ it 'should match on first server ip' do
100
+ expect(metric_connections.search("//stringProp[@name='']").first.text).to eq '1.1.1.1'
101
+ end
102
+ end
103
+
104
+ describe 'redis data set' do
105
+ describe 'random keep' do
106
+ let(:doc) do
107
+ test do
108
+ threads do
109
+ redis_data_set name: 'redis data set name',
110
+ host: 'the_host',
111
+ port: 1234
112
+
113
+ end
114
+ end.to_doc
115
+ end
116
+
117
+ let(:fragment) { doc.search("//kg.apc.jmeter.config.redis.RedisDataSet").first }
118
+
119
+ it 'should have a name' do
120
+ expect(fragment.attributes['testname'].value).to eq 'redis data set name'
121
+ end
122
+
123
+ it 'should be configured for random keep' do
124
+ expect(fragment.search("//intProp[@name='getMode']").text).to eq '1'
125
+ end
126
+
127
+ it 'should point to the host' do
128
+ expect(fragment.search("//stringProp[@name='host']").text).to eq 'the_host'
129
+ end
130
+
131
+ it 'should configure a port' do
132
+ expect(fragment.search("//stringProp[@name='port']").text).to eq '1234'
133
+ end
134
+ end
135
+
136
+ describe 'random remove' do
137
+ let(:doc) do
138
+ test do
139
+ threads do
140
+ redis_data_set remove: true
141
+ end
142
+ end.to_doc
143
+ end
144
+
145
+ let(:fragment) { doc.search("//kg.apc.jmeter.config.redis.RedisDataSet").first }
146
+
147
+ it 'should have a default name' do
148
+ expect(fragment.attributes['testname'].value).to eq 'Redis Data Set Config'
149
+ end
150
+
151
+ it 'should be configured for random remove' do
152
+ expect(fragment.search("//intProp[@name='getMode']").text).to eq '0'
153
+ end
154
+ end
155
+ end