gridinit-jmeter 0.3.2 → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. data/Gemfile +2 -1
  2. data/README.md +51 -72
  3. data/examples/basic_assertion.rb +6 -6
  4. data/examples/basic_auth.rb +5 -5
  5. data/examples/basic_cache.rb +5 -5
  6. data/examples/basic_cookies.rb +5 -5
  7. data/examples/basic_extract.rb +4 -10
  8. data/examples/basic_gc_results.rb +12 -9
  9. data/examples/basic_google.rb +3 -3
  10. data/examples/basic_grid.rb +3 -6
  11. data/examples/basic_header.rb +12 -10
  12. data/examples/basic_ldap_ext.rb +11 -12
  13. data/examples/basic_post.rb +5 -6
  14. data/examples/basic_query_params.rb +3 -3
  15. data/examples/basic_think_time.rb +7 -4
  16. data/examples/basic_throughput_shaping_timer.rb +4 -4
  17. data/examples/etsy_login_browse.rb +21 -21
  18. data/lib/gridinit-jmeter/DSL.md +237 -0
  19. data/lib/gridinit-jmeter/{idl → dsl}/access_log_sampler.rb +4 -2
  20. data/lib/gridinit-jmeter/{idl → dsl}/aggregate_graph.rb +4 -2
  21. data/lib/gridinit-jmeter/{idl → dsl}/aggregate_report.rb +4 -2
  22. data/lib/gridinit-jmeter/{idl → dsl}/ajp13_sampler.rb +5 -3
  23. data/lib/gridinit-jmeter/{idl → dsl}/assertion_results.rb +4 -2
  24. data/lib/gridinit-jmeter/{idl → dsl}/beanshell_assertion.rb +4 -2
  25. data/lib/gridinit-jmeter/{idl → dsl}/beanshell_listener.rb +4 -2
  26. data/lib/gridinit-jmeter/{idl → dsl}/beanshell_postprocessor.rb +4 -2
  27. data/lib/gridinit-jmeter/{idl → dsl}/beanshell_preprocessor.rb +4 -2
  28. data/lib/gridinit-jmeter/{idl → dsl}/beanshell_sampler.rb +4 -2
  29. data/lib/gridinit-jmeter/{idl → dsl}/beanshell_timer.rb +4 -2
  30. data/lib/gridinit-jmeter/{idl → dsl}/bsf_assertion.rb +4 -2
  31. data/lib/gridinit-jmeter/{idl → dsl}/bsf_listener.rb +4 -2
  32. data/lib/gridinit-jmeter/{idl → dsl}/bsf_postprocessor.rb +4 -2
  33. data/lib/gridinit-jmeter/{idl → dsl}/bsf_preprocessor.rb +4 -2
  34. data/lib/gridinit-jmeter/{idl → dsl}/bsf_sampler.rb +4 -2
  35. data/lib/gridinit-jmeter/{idl → dsl}/bsf_timer.rb +4 -2
  36. data/lib/gridinit-jmeter/{idl → dsl}/compare_assertion.rb +4 -2
  37. data/lib/gridinit-jmeter/{idl → dsl}/comparison_assertion_visualizer.rb +4 -2
  38. data/lib/gridinit-jmeter/{idl → dsl}/constant_throughput_timer.rb +4 -2
  39. data/lib/gridinit-jmeter/{idl → dsl}/constant_timer.rb +4 -2
  40. data/lib/gridinit-jmeter/{idl → dsl}/counter.rb +4 -2
  41. data/lib/gridinit-jmeter/{idl → dsl}/cssjquery_extractor.rb +4 -2
  42. data/lib/gridinit-jmeter/{idl → dsl}/csv_data_set_config.rb +4 -2
  43. data/lib/gridinit-jmeter/{idl → dsl}/debug_postprocessor.rb +4 -2
  44. data/lib/gridinit-jmeter/{idl → dsl}/debug_sampler.rb +4 -2
  45. data/lib/gridinit-jmeter/{idl → dsl}/distribution_graphalpha.rb +4 -2
  46. data/lib/gridinit-jmeter/{idl → dsl}/duration_assertion.rb +4 -2
  47. data/lib/gridinit-jmeter/{idl → dsl}/foreach_controller.rb +4 -2
  48. data/lib/gridinit-jmeter/{idl → dsl}/ftp_request.rb +4 -2
  49. data/lib/gridinit-jmeter/{idl → dsl}/ftp_request_defaults.rb +4 -2
  50. data/lib/gridinit-jmeter/{idl → dsl}/gaussian_random_timer.rb +4 -2
  51. data/lib/gridinit-jmeter/{idl → dsl}/generate_summary_results.rb +4 -2
  52. data/lib/gridinit-jmeter/{idl → dsl}/graph_results.rb +4 -2
  53. data/lib/gridinit-jmeter/{idl → dsl}/html_assertion.rb +4 -2
  54. data/lib/gridinit-jmeter/{idl → dsl}/html_link_parser.rb +4 -2
  55. data/lib/gridinit-jmeter/{idl → dsl}/html_parameter_mask.rb +4 -2
  56. data/lib/gridinit-jmeter/dsl/http_authorization_manager.rb +36 -0
  57. data/lib/gridinit-jmeter/{idl → dsl}/http_cache_manager.rb +4 -2
  58. data/lib/gridinit-jmeter/{idl → dsl}/http_cookie_manager.rb +5 -2
  59. data/lib/gridinit-jmeter/{idl → dsl}/http_header_manager.rb +10 -3
  60. data/lib/gridinit-jmeter/{idl → dsl}/http_request.rb +5 -3
  61. data/lib/gridinit-jmeter/{idl → dsl}/http_request_defaults.rb +15 -4
  62. data/lib/gridinit-jmeter/{idl → dsl}/http_url_rewriting_modifier.rb +4 -2
  63. data/lib/gridinit-jmeter/{idl → dsl}/if_controller.rb +5 -2
  64. data/lib/gridinit-jmeter/{idl → dsl}/include_controller.rb +4 -2
  65. data/lib/gridinit-jmeter/{idl → dsl}/java_request.rb +4 -2
  66. data/lib/gridinit-jmeter/{idl → dsl}/java_request_defaults.rb +4 -2
  67. data/lib/gridinit-jmeter/{idl → dsl}/jdbc_connection_configuration.rb +4 -2
  68. data/lib/gridinit-jmeter/{idl → dsl}/jdbc_postprocessor.rb +4 -2
  69. data/lib/gridinit-jmeter/{idl → dsl}/jdbc_preprocessor.rb +4 -2
  70. data/lib/gridinit-jmeter/{idl → dsl}/jdbc_request.rb +4 -2
  71. data/lib/gridinit-jmeter/{idl → dsl}/jms_pointtopoint.rb +6 -4
  72. data/lib/gridinit-jmeter/{idl → dsl}/jms_publisher.rb +5 -3
  73. data/lib/gridinit-jmeter/{idl → dsl}/jms_subscriber.rb +4 -2
  74. data/lib/gridinit-jmeter/{idl → dsl}/jsr223_assertion.rb +4 -2
  75. data/lib/gridinit-jmeter/{idl → dsl}/jsr223_listener.rb +4 -2
  76. data/lib/gridinit-jmeter/{idl → dsl}/jsr223_postprocessor.rb +4 -2
  77. data/lib/gridinit-jmeter/{idl → dsl}/jsr223_preprocessor.rb +4 -2
  78. data/lib/gridinit-jmeter/{idl → dsl}/jsr223_sampler.rb +4 -2
  79. data/lib/gridinit-jmeter/{idl → dsl}/jsr223_timer.rb +4 -2
  80. data/lib/gridinit-jmeter/{idl → dsl}/junit_request.rb +4 -2
  81. data/lib/gridinit-jmeter/{idl → dsl}/keystore_configuration.rb +4 -2
  82. data/lib/gridinit-jmeter/{idl → dsl}/ldap_extended_request.rb +4 -2
  83. data/lib/gridinit-jmeter/{idl → dsl}/ldap_extended_request_defaults.rb +4 -2
  84. data/lib/gridinit-jmeter/{idl → dsl}/ldap_request.rb +5 -3
  85. data/lib/gridinit-jmeter/{idl → dsl}/ldap_request_defaults.rb +13 -4
  86. data/lib/gridinit-jmeter/{idl → dsl}/login_config_element.rb +4 -2
  87. data/lib/gridinit-jmeter/{idl → dsl}/loop_controller.rb +4 -2
  88. data/lib/gridinit-jmeter/{idl → dsl}/mail_reader_sampler.rb +4 -2
  89. data/lib/gridinit-jmeter/{idl → dsl}/mailer_visualizer.rb +4 -2
  90. data/lib/gridinit-jmeter/{idl → dsl}/md5hex_assertion.rb +4 -2
  91. data/lib/gridinit-jmeter/{idl → dsl}/module_controller.rb +4 -2
  92. data/lib/gridinit-jmeter/{idl → dsl}/monitor_results.rb +4 -2
  93. data/lib/gridinit-jmeter/{idl → dsl}/once_only_controller.rb +4 -2
  94. data/lib/gridinit-jmeter/{idl → dsl}/os_process_sampler.rb +6 -4
  95. data/lib/gridinit-jmeter/{idl → dsl}/poisson_random_timer.rb +4 -2
  96. data/lib/gridinit-jmeter/{idl → dsl}/random_controller.rb +4 -2
  97. data/lib/gridinit-jmeter/{idl → dsl}/random_order_controller.rb +4 -2
  98. data/lib/gridinit-jmeter/{idl → dsl}/random_variable.rb +4 -2
  99. data/lib/gridinit-jmeter/{idl → dsl}/recording_controller.rb +4 -2
  100. data/lib/gridinit-jmeter/{idl → dsl}/regex_user_parameters.rb +4 -2
  101. data/lib/gridinit-jmeter/{idl → dsl}/regular_expression_extractor.rb +5 -2
  102. data/lib/gridinit-jmeter/{idl → dsl}/response_assertion.rb +8 -3
  103. data/lib/gridinit-jmeter/{idl → dsl}/response_time_graph.rb +4 -2
  104. data/lib/gridinit-jmeter/{idl → dsl}/result_status_action_handler.rb +4 -2
  105. data/lib/gridinit-jmeter/{idl → dsl}/runtime_controller.rb +4 -2
  106. data/lib/gridinit-jmeter/{idl → dsl}/save_responses_to_a_file.rb +4 -2
  107. data/lib/gridinit-jmeter/{idl → dsl}/simple_config_element.rb +4 -2
  108. data/lib/gridinit-jmeter/{idl → dsl}/simple_controller.rb +4 -2
  109. data/lib/gridinit-jmeter/{idl → dsl}/simple_data_writer.rb +4 -2
  110. data/lib/gridinit-jmeter/{idl → dsl}/smime_assertion.rb +4 -2
  111. data/lib/gridinit-jmeter/{idl → dsl}/smtp_sampler.rb +4 -2
  112. data/lib/gridinit-jmeter/{idl → dsl}/soapxmlrpc_request.rb +4 -2
  113. data/lib/gridinit-jmeter/{idl → dsl}/spline_visualizer.rb +4 -2
  114. data/lib/gridinit-jmeter/{idl → dsl}/summary_report.rb +4 -2
  115. data/lib/gridinit-jmeter/{idl → dsl}/switch_controller.rb +4 -2
  116. data/lib/gridinit-jmeter/{idl → dsl}/synchronizing_timer.rb +4 -2
  117. data/lib/gridinit-jmeter/{idl → dsl}/tcp_sampler.rb +4 -2
  118. data/lib/gridinit-jmeter/{idl → dsl}/tcp_sampler_config.rb +4 -2
  119. data/lib/gridinit-jmeter/{idl → dsl}/test_action.rb +4 -2
  120. data/lib/gridinit-jmeter/{idl → dsl}/test_plan.rb +5 -3
  121. data/lib/gridinit-jmeter/{idl → dsl}/thread_group.rb +5 -3
  122. data/lib/gridinit-jmeter/{idl → dsl}/throughput_controller.rb +5 -3
  123. data/lib/gridinit-jmeter/{idl → dsl}/transaction_controller.rb +6 -3
  124. data/lib/gridinit-jmeter/{idl → dsl}/uniform_random_timer.rb +4 -2
  125. data/lib/gridinit-jmeter/dsl/user_defined_variables.rb +35 -0
  126. data/lib/gridinit-jmeter/{idl → dsl}/user_parameters.rb +4 -2
  127. data/lib/gridinit-jmeter/{idl → dsl}/view_results_in_table.rb +4 -2
  128. data/lib/gridinit-jmeter/{idl → dsl}/view_results_tree.rb +4 -2
  129. data/lib/gridinit-jmeter/{idl → dsl}/while_controller.rb +4 -2
  130. data/lib/gridinit-jmeter/{idl → dsl}/xml_assertion.rb +4 -2
  131. data/lib/gridinit-jmeter/{idl → dsl}/xml_schema_assertion.rb +4 -2
  132. data/lib/gridinit-jmeter/{idl → dsl}/xpath_assertion.rb +4 -2
  133. data/lib/gridinit-jmeter/{idl → dsl}/xpath_extractor.rb +4 -2
  134. data/lib/gridinit-jmeter/dsl.rb +170 -187
  135. data/lib/gridinit-jmeter/helpers/helper.rb +43 -0
  136. data/lib/gridinit-jmeter/helpers/parser.rb +109 -0
  137. data/lib/gridinit-jmeter/idl.rb +16 -6
  138. data/lib/gridinit-jmeter/idl.xml +54 -11
  139. data/lib/gridinit-jmeter/{listeners → plugins}/gc_console_status_logger.rb +0 -0
  140. data/lib/gridinit-jmeter/{listeners → plugins}/gc_latencies_over_time.rb +0 -0
  141. data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_codes_per_second.rb +0 -0
  142. data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_distribution.rb +0 -0
  143. data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_over_time.rb +0 -0
  144. data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_percentiles.rb +0 -0
  145. data/lib/gridinit-jmeter/{listeners → plugins}/gc_transactions_per_second.rb +0 -0
  146. data/lib/gridinit-jmeter/{timers/gc_throughput_shaping_timer.rb → plugins/gc_variable_throughput_timer.rb} +1 -1
  147. data/lib/gridinit-jmeter/version.rb +1 -1
  148. data/lib/gridinit-jmeter.rb +6 -105
  149. data/spec/dsl_spec.rb +377 -82
  150. metadata +131 -174
  151. data/examples/basic_proxy.rb +0 -8
  152. data/examples/basic_results.rb +0 -22
  153. data/examples/basic_run.rb +0 -12
  154. data/examples/basic_simple_data_writer.rb +0 -14
  155. data/examples/basic_stdout.rb +0 -8
  156. data/examples/basic_test_data.rb +0 -15
  157. data/examples/basic_testplan.jmx +0 -138
  158. data/examples/basic_testplan.rb +0 -44
  159. data/examples/jbhifi_now_search.rb +0 -94
  160. data/lib/gridinit-jmeter/assertions/response_assertion.rb +0 -55
  161. data/lib/gridinit-jmeter/config/auth_manager.rb +0 -26
  162. data/lib/gridinit-jmeter/config/cache_manager.rb +0 -20
  163. data/lib/gridinit-jmeter/config/cookie_manager.rb +0 -21
  164. data/lib/gridinit-jmeter/config/counter_config.rb +0 -24
  165. data/lib/gridinit-jmeter/config/header_manager.rb +0 -26
  166. data/lib/gridinit-jmeter/config/random_variable.rb +0 -24
  167. data/lib/gridinit-jmeter/config/request_defaults.rb +0 -31
  168. data/lib/gridinit-jmeter/config/user_defined_variable.rb +0 -25
  169. data/lib/gridinit-jmeter/controllers/if_controller.rb +0 -20
  170. data/lib/gridinit-jmeter/controllers/interleave.rb +0 -18
  171. data/lib/gridinit-jmeter/controllers/loop_controller.rb +0 -19
  172. data/lib/gridinit-jmeter/controllers/once_only.rb +0 -17
  173. data/lib/gridinit-jmeter/controllers/random_order.rb +0 -16
  174. data/lib/gridinit-jmeter/controllers/simple.rb +0 -17
  175. data/lib/gridinit-jmeter/controllers/switch.rb +0 -20
  176. data/lib/gridinit-jmeter/controllers/throughput.rb +0 -26
  177. data/lib/gridinit-jmeter/controllers/transaction.rb +0 -19
  178. data/lib/gridinit-jmeter/controllers/while_controller.rb +0 -18
  179. data/lib/gridinit-jmeter/helpers/dsl_helper.rb +0 -21
  180. data/lib/gridinit-jmeter/idl/http_authorization_manager.rb +0 -26
  181. data/lib/gridinit-jmeter/idl/user_defined_variables.rb +0 -26
  182. data/lib/gridinit-jmeter/listeners/aggregate_report.rb +0 -47
  183. data/lib/gridinit-jmeter/listeners/graph_visualizer.rb +0 -46
  184. data/lib/gridinit-jmeter/listeners/response_time_graph_visualizer.rb +0 -47
  185. data/lib/gridinit-jmeter/listeners/simple_data_writer.rb +0 -51
  186. data/lib/gridinit-jmeter/listeners/stat_visualizer.rb +0 -46
  187. data/lib/gridinit-jmeter/listeners/summary_report.rb +0 -46
  188. data/lib/gridinit-jmeter/listeners/table_visualizer.rb +0 -46
  189. data/lib/gridinit-jmeter/listeners/view_results_full_visualizer.rb +0 -57
  190. data/lib/gridinit-jmeter/post_processors/regex_extractor.rb +0 -34
  191. data/lib/gridinit-jmeter/post_processors/xpath_extractor.rb +0 -23
  192. data/lib/gridinit-jmeter/pre_processors/bean_shell_pre_processor.rb +0 -23
  193. data/lib/gridinit-jmeter/samplers/http_sampler.rb +0 -99
  194. data/lib/gridinit-jmeter/samplers/ldap_ext_sampler.rb +0 -36
  195. data/lib/gridinit-jmeter/samplers/soap_sampler.rb +0 -26
  196. data/lib/gridinit-jmeter/test_plan/test_plan.rb +0 -23
  197. data/lib/gridinit-jmeter/threads/thread_group.rb +0 -30
  198. data/lib/gridinit-jmeter/timers/gaussian_random_timer.rb +0 -18
data/Gemfile CHANGED
@@ -14,7 +14,7 @@ end
14
14
  group :development do
15
15
  gem 'pry', :require => 'pry'
16
16
  gem 'pry-nav', :require => 'pry-nav'
17
- gem 'pry-debugger'
17
+ gem 'pry-debugger', :require => 'pry-debugger'
18
18
  gem 'awesome_print', :require => 'ap'
19
19
  end
20
20
 
@@ -23,4 +23,5 @@ group :test do
23
23
  gem 'rspec'
24
24
  gem 'sinatra'
25
25
  gem 'haml'
26
+ gem 'pry-debugger', :require => 'pry-debugger'
26
27
  end
data/README.md CHANGED
@@ -28,8 +28,8 @@ Let's create a `test` and save the related `jmx` testplan to file, so we can edi
28
28
 
29
29
  ```ruby
30
30
  test do
31
- threads 10 do
32
- visit 'Google Search', 'http://google.com'
31
+ threads count: 10 do
32
+ visit name: 'Google Search', url: 'http://google.com'
33
33
  end
34
34
  end.jmx
35
35
  ```
@@ -60,8 +60,8 @@ The file that is created can then be executed in the JMeter GUI. If you want to
60
60
 
61
61
  ```ruby
62
62
  test do
63
- threads 10 do
64
- visit 'Google Search', 'http://google.com'
63
+ threads count: 10 do
64
+ visit name: 'Google Search', url: 'http://google.com'
65
65
  end
66
66
  end.jmx(file: "/tmp/my_testplan.jmx")
67
67
  ```
@@ -77,8 +77,8 @@ You can execute the JMeter test plan by calling the `run` method of the test lik
77
77
 
78
78
  ```ruby
79
79
  test do
80
- threads 10 do
81
- visit 'Google Search', 'http://google.com'
80
+ threads count: 10 do
81
+ visit name: 'Google Search', url: 'http://google.com'
82
82
  end
83
83
  end.run
84
84
  ```
@@ -87,8 +87,8 @@ This will launch JMeter in headless (non-GUI mode) and execute the test plan. Th
87
87
 
88
88
  ```ruby
89
89
  test do
90
- threads 10 do
91
- visit 'Google Search', 'http://google.com'
90
+ threads count: 10 do
91
+ visit name: 'Google Search', url: 'http://google.com'
92
92
  end
93
93
  end.run(
94
94
  path: '/usr/share/jmeter/bin/',
@@ -105,8 +105,8 @@ To execute the test on the Grid, call the `grid` method on the test and pass it
105
105
 
106
106
  ```ruby
107
107
  test do
108
- threads 10 do
109
- visit 'Google Search', 'http://google.com'
108
+ threads count: 10 do
109
+ visit name: 'Google Search', url: 'http://google.com'
110
110
  end
111
111
  end.grid('OxtZ-4v-v0koSz5Y0enEQQ')
112
112
  ```
@@ -127,9 +127,9 @@ Blocks let you nest methods within methods, so you can scope the execution of me
127
127
 
128
128
  ```ruby
129
129
  test do
130
- threads 100 do
131
- visit 'Home', 'http://altentee.com' do
132
- extract 'csrf-token', "content='(.+?)' name='csrf-token'"
130
+ threads count: 100 do
131
+ visit name: 'Home', url: 'http://altentee.com' do
132
+ extract regex: "content='(.+?)' name='csrf-token'", name: 'csrf-token'
133
133
  end
134
134
  end
135
135
  end
@@ -139,26 +139,20 @@ This would create a new test plan, with a 100 user thread group, each user visit
139
139
 
140
140
  All methods are nestable, but you should only have one test method, and typically only one threads method. For example, it wouldn't make sense to have a test plan within a test plan, or a thread group within a thread group. You can have multiple thread groups per test plan though. This implies *some* knowlege of how JMeter works.
141
141
 
142
+ All methods take a parameter hash to configure related options.
143
+
142
144
  ### Threads
143
145
 
144
146
  You can use the `threads` method to define a group of users:
145
147
 
146
148
  ```ruby
147
- threads 100
148
- ```
149
-
150
- This methods takes 2 parameters: the number of threads and an optional parameters hash.
151
-
152
- ```ruby
153
- threads 100
154
- threads 100, {continue_forever: 'true'}
155
- threads 100, {loops: 10}
156
- threads 100, {ramp_time: 30, duration: 60}
157
- threads 100, {
158
- scheduler: 'true',
149
+ threads count: 100
150
+ threads count: 100, continue_forever: true
151
+ threads count: 100, loops: 10
152
+ threads count: 100, ramup: 30, duration: 60
153
+ threads count: 100, scheduler: true,
159
154
  start_time: Time.now.to_i * 1000,
160
155
  end_time: (Time.now.to_i * 1000) + (3600 * 1000)
161
- }
162
156
  ```
163
157
 
164
158
  ### Cookies
@@ -228,28 +222,19 @@ end
228
222
  You can use the `visit` method to navigate to pages:
229
223
 
230
224
  ```ruby
231
- visit 'Google Search', 'http://google.com'
232
- ```
233
-
234
- This method makes a single request and takes 3 parameters: the label, the URL and an optional parameters hash.
235
-
236
- ```ruby
237
- visit 'Google Search', 'http://google.com'
238
- visit 'Google Search', 'http://google.com', {
225
+ visit name: 'Google Search', url: 'http://google.com'
226
+ visit name: 'Google Search', url: 'http://google.com'
227
+ visit name: 'Google Search', url: 'http://google.com',
239
228
  method: 'POST',
240
- DO_MULTIPART_POST: 'true'
241
- }
242
- visit 'Google Search', 'http://google.com', {
229
+ 'DO_MULTIPART_POST': 'true'
230
+ visit name: 'Google Search', url: 'http://google.com',
243
231
  use_keepalive: 'false'
244
- }
245
- visit 'Google Search', 'http://google.com', {
232
+ visit name: 'Google Search', url: 'http://google.com',
246
233
  connect_timeout: '1000',
247
- response_timeout: '60000',
248
- }
249
- visit 'View Login', '/login', {
234
+ response_timeout: '60000'
235
+ visit name: 'View Login', url: '/login',
250
236
  protocol: "https",
251
237
  port: 443
252
- }
253
238
  ```
254
239
 
255
240
  ### Submitting a Form
@@ -257,7 +242,7 @@ visit 'View Login', '/login', {
257
242
  You can use the `submit` method to POST a HTTP form:
258
243
 
259
244
  ```ruby
260
- submit 'Submit Form', 'http://altentee.com/', {
245
+ submit name: 'Submit Form', url: 'http://altentee.com/',
261
246
  fill_in: {
262
247
  username: 'tim',
263
248
  password: 'password',
@@ -265,7 +250,7 @@ submit 'Submit Form', 'http://altentee.com/', {
265
250
  }
266
251
  ```
267
252
 
268
- This method makes a single request and takes 3 parameters: the label, the URL and an optional parameters hash. The fill_in parameter lets you specify key/value pairs for form field parameters. You can also use the built in JMeter `${expression}` language to access run time variables extracted from previous responses.
253
+ This method makes a single request. The fill_in parameter lets you specify key/value pairs for form field parameters. You can also use the built in JMeter `${expression}` language to access run time variables extracted from previous responses.
269
254
 
270
255
  ### Think Time
271
256
 
@@ -289,33 +274,26 @@ random_timer 1000,5000
289
274
  You can use the `extract` method to extract values from a server response using a regular expression. This is aliased as the `web_reg_save_param` method. This method is typically used inside a `visit` or `submit` block.
290
275
 
291
276
  ```ruby
292
- extract 'csrf-token', "content='(.+?)' name='csrf-token'"
293
- ```
277
+ extract regex: "content='(.+?)' name='csrf-token'", name: 'csrf-token'
294
278
 
295
- This method takes 4 parameters: the selector (xpath or regex), the extracted value name, the PCRE regular expression and an optional parameters hash. The selector is optional and defaults to regex. You can specify regex or xpath extractors as follows.
296
-
297
- ```
298
- visit 'Google', "http://google.com/" do
299
- extract 'button_text', 'aria-label="(.+?)"'
300
- extract :regex, 'button_text', 'aria-label="(.+?)"'
301
- extract :xpath, 'button', '//button'
279
+ visit name: 'Google', url: "http://google.com/" do
280
+ extract regex: 'aria-label="(.+?)"', name: 'button_text'
281
+ extract xpath: '//button', name: 'button'
302
282
  end
303
283
  ```
304
284
 
305
285
  This is based on the [Regular Expression Extractor](http://jmeter.apache.org/usermanual/component_reference.html#Regular_Expression_Extractor) and [XPath Extractor](http://jmeter.apache.org/usermanual/component_reference.html#XPath_Extractor)
306
286
 
307
287
  ```ruby
308
- visit "Altentee", "http://altentee.com" do
309
- extract 'csrf-token', "content='(.+?)' name='csrf-token'"
310
- extract 'JSESSIONID', 'value="(.+?)" name="JESSIONSID"'
311
- web_reg_save_param 'VIEWSTATE', 'value="(.+?)" name="VIEWSTATE"'
312
- extract 'username', 'value="(.+?)" name="username"', {
288
+ visit name: "Altentee", url: "http://altentee.com" do
289
+ extract regex: "content='(.+?)' name='csrf-token'", name: 'csrf-token'
290
+ extract regex: 'value="(.+?)" name="JESSIONSID"', name: 'JSESSIONID'
291
+ web_reg_save_param regex: 'value="(.+?)" name="VIEWSTATE"', name: 'VIEWSTATE'
292
+ extract name: 'username', regex: 'value="(.+?)", name="username"',
313
293
  default: 'Tim Koopmans',
314
294
  match_number: 1
315
- }
316
- extract 'shopping_item', 'id="(.+?)" name="book"', {
295
+ extract name: 'shopping_item', regex: 'id="(.+?)" name="book"',
317
296
  match_number: 0 # random
318
- }
319
297
  end
320
298
  ```
321
299
 
@@ -325,7 +303,7 @@ You can use the `assert` method to extract values from a server response using a
325
303
 
326
304
  ```ruby
327
305
  visit "Altentee", "http://altentee.com" do
328
- assert "contains", "We test, tune and secure your site"
306
+ assert contains: "We test, tune and secure your site"
329
307
  end
330
308
  ```
331
309
 
@@ -334,12 +312,12 @@ This method takes 3 parameters: the matching rule, the test string, and an optio
334
312
 
335
313
  ```ruby
336
314
  visit "Altentee", "http://altentee.com" do
337
- assert "contains", "We test, tune and secure your site"
338
- assert "not-contains", "We price gouge on cloud services"
339
- assert "matches", "genius"
340
- assert "not-matches", "fakers"
341
- assert "contains", "magic"
342
- assert "not-contains", "unicorns", {scope: 'all'}
315
+ assert "contains": "We test, tune and secure your site"
316
+ assert "not-contains": "We price gouge on cloud services"
317
+ assert "matches": "genius"
318
+ assert "not-matches": "fakers"
319
+ assert "contains": "magic"
320
+ assert "not-contains": "unicorns", scope: 'all'
343
321
  end
344
322
  ```
345
323
 
@@ -351,6 +329,7 @@ This is very much a work-in-progress. Future work is being sponsored by Gridinit
351
329
 
352
330
  1. Fork it
353
331
  2. Create your feature branch (`git checkout -b my-new-feature`)
354
- 3. Commit your changes (`git commit -am 'Add some feature'`)
355
- 4. Push to the branch (`git push origin my-new-feature`)
356
- 5. Create new Pull Request
332
+ 3. Create some specs, make them pass
333
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
334
+ 5. Push to the branch (`git push origin my-new-feature`)
335
+ 6. Create new Pull Request
@@ -2,12 +2,12 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- threads 2 do
6
- transaction 'Assertions' do
7
- visit 'Altentee', 'http://altentee.com/' do
8
- assert "contains", "We test, tune and secure your site"
9
- assert "not-contains", "Something in frames", {:scope => 'all'}
5
+ threads count: 2 do
6
+ transaction name: 'Assertions' do
7
+ visit name: 'Altentee', url: 'http://altentee.com/' do
8
+ assert contains: 'We test, tune and secure your site'
9
+ assert 'not-contains' => 'Something in frames', scope: 'children'
10
10
  end
11
11
  end
12
12
  end
13
- end.jmx
13
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,10 +2,10 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- auth :url => '/', :username => 'tim', :password => 'secret', :domain => 'altentee.com'
6
- threads 1 do
7
- transaction 'Google Search' do
8
- visit 'Home Page', 'http://google.com/'
5
+ auth url: '/', username: 'tim', password: 'secret', domain: 'altentee.com'
6
+ threads count: 1 do
7
+ transaction name: 'Google Search' do
8
+ visit name: 'Home Page', url: 'http://google.com/'
9
9
  end
10
10
  end
11
- end.jmx
11
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,10 +2,10 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- cache :clear_each_iteration => true
6
- threads 1 do
7
- transaction 'Google Search' do
8
- visit 'Home Page', 'http://google.com/'
5
+ cache clear_each_iteration: true
6
+ threads count: 1 do
7
+ transaction name: 'Google Search' do
8
+ visit name: 'Home Page', url: 'http://google.com/'
9
9
  end
10
10
  end
11
- end.jmx
11
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,10 +2,10 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- cookies :clear_each_iteration => false
6
- threads 1 do
7
- transaction 'Google Search' do
8
- visit 'Home Page', 'http://google.com/'
5
+ cookies clear_each_iteration: false
6
+ threads count: 1 do
7
+ transaction name: 'Google Search' do
8
+ visit name: 'Home Page', url: 'http://google.com/'
9
9
  end
10
10
  end
11
- end.jmx
11
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,15 +2,9 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
-
6
- threads 100 do
7
-
8
- visit 'Google', "http://google.com/" do
9
- extract 'button_text', 'aria-label="(.+?)"'
10
- extract :regex, 'button_text', 'aria-label="(.+?)"'
11
- extract :xpath, 'button', '//button'
5
+ threads count: 100 do
6
+ visit name: 'Home', url: 'http://altentee.com' do
7
+ extract regex: "content='(.+?)' name='csrf-token'", name: 'csrf-token'
12
8
  end
13
-
14
9
  end
15
-
16
- end.jmx
10
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,19 +2,22 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- threads 1, { :loops => 10 } do
6
- visit 'Google Search', 'http://google.com'
5
+ cookies clear_each_iteration: false
6
+ threads count: 1 do
7
+ transaction name: 'Google Search' do
8
+ visit name: 'Home Page', url: 'http://google.com/'
9
+ end
7
10
  end
8
11
 
9
12
  #
10
13
  # You need jmeter-plugins at Google code
11
14
  # http://code.google.com/p/jmeter-plugins
12
15
  #
13
- gc_latencies_over_time 'Response Latencies Over Time'
14
- gc_response_codes_per_second 'Response Codes per Second'
15
- gc_response_times_distribution 'Response Times Distribution'
16
- gc_response_times_over_time 'Response Times Over Time'
17
- gc_response_times_percentiles 'Response Times Percentiles'
18
- gc_transactions_per_second 'Transactions per Second'
16
+ latencies_over_time 'Response Latencies Over Time'
17
+ response_codes_per_second 'Response Codes per Second'
18
+ response_times_distribution 'Response Times Distribution'
19
+ response_times_over_time 'Response Times Over Time'
20
+ response_times_percentiles 'Response Times Percentiles'
21
+ transactions_per_second 'Transactions per Second'
19
22
 
20
- end.jmx
23
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- threads 10 do
6
- visit 'Google Search', 'http://google.com'
5
+ threads count: 1 do
6
+ visit name: 'Home Page', url: 'http://google.com/'
7
7
  end
8
- end.jmx
8
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,10 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- think_time 100
6
- threads 100, {:ramp_time => 10, :loops => 10} do
7
- transaction 'Home Page' do
8
- visit 'Altentee', 'http://127.0.0.1:9200/'
9
- end
5
+ threads count: 1 do
6
+ visit name: 'Home Page', url: 'http://google.com/'
10
7
  end
11
- end.grid('4dy-zJLEIgpYkKe6p6JhSQ', {:endpoint => '127.0.0.1:3000', :region => 'ap_southeast_1'})
8
+ end.grid('4dy-zJLEIgpYkKe6p6JhSQ', {:region => 'ap_southeast_1'})
@@ -2,16 +2,18 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- header 'User-Agent' => 'Firefox'
6
- threads 1 do
7
- transaction 'Google Search' do
8
- visit 'Home Page', 'http://google.com/'
9
- end
5
+ header name: 'Accept', value: '*'
6
+
7
+ with_user_agent :iphone
8
+
9
+ threads count: 1 do
10
+ visit name: 'Home Page', url: 'http://google.com/'
11
+ end
10
12
 
11
- transaction 'Google Search via XHR' do
12
- visit 'Home Page', 'http://google.com/' do
13
- header 'X-Requested-With' => 'XMLHttpRequest'
14
- end
13
+ transaction name: 'Google Search via XHR' do
14
+ visit name: 'Home Page', url: 'http://google.com/' do
15
+ with_xhr
15
16
  end
16
17
  end
17
- end.jmx
18
+
19
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,16 +2,15 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- threads 1 do
6
- ldap_ext 'ldap_ext sample',
7
- { 'test' => 'sbind',
8
- 'user_dn' => 'user_dn',
9
- 'user_pw' => 'user_password',
10
- 'servername' => 'your_ldap_server',
11
- 'secure' => true,
12
- 'port' => 636
13
- }
5
+ threads count: 1 do
6
+ ldap_ext name: 'ldap_ext sample',
7
+ test: 'sbind',
8
+ user_dn: 'user_dn',
9
+ user_pw: 'user_password',
10
+ servername: 'your_ldap_server',
11
+ secure: true,
12
+ port: 636
13
+
14
14
  end
15
- view_results 'tree'
16
- end.jmx
17
-
15
+ view_results name: 'debug'
16
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -3,14 +3,13 @@ require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
5
 
6
- threads 1 do
6
+ threads count: 1 do
7
7
 
8
- transaction 'Post with a Raw Body', {:parent => true} do
9
- post 'Home Page', 'http://google.com', {
10
- :raw_body => '{"name":"Big Poncho","price":10,"vendor_attendance_id":24,"product_id":1}'
11
- }
8
+ transaction name: 'Post with a Raw Body', parent: false do
9
+ post name: 'Home Page', url: 'http://google.com',
10
+ raw_body: '{"name":"Big Poncho","price":10,"vendor_attendance_id":24,"product_id":1}'
12
11
  end
13
12
 
14
13
  end
15
14
 
16
- end.jmx
15
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- threads 10 do
6
- visit 'Google Search', 'http://google.com/?hl=en&tbo=d&sclient=psy-ab&q=gridinit&oq=gridinit'#, {always_encode: true}
5
+ threads count: 10 do
6
+ visit name: 'Google Search', url: 'http://google.com/?hl=en&tbo=d&sclient=psy-ab&q=gridinit&oq=gridinit'
7
7
  end
8
- end.jmx
8
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,11 +2,14 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- threads 100 do
5
+ threads count: 100 do
6
+
6
7
  think_time 5000,5000
7
- transaction 'Google Search' do
8
- visit 'Home Page', 'http://google.com/'
8
+
9
+ transaction name: 'Google Search' do
10
+ visit name: 'Home Page', url: 'http://google.com/'
9
11
  random_timer 3000
10
12
  end
13
+
11
14
  end
12
- end.jmx
15
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'gridinit-jmeter'
3
3
 
4
4
  test do
5
- threads 100 do # threads = RPS * <max response time ms> / 1000
5
+ threads count: 100 do # threads = RPS * <max response time ms> / 1000
6
6
 
7
7
  throughput_shaper 'increasing load test', [
8
8
  { :start_rps => 100, :end_rps => 100, :duration => 60 },
@@ -13,9 +13,9 @@ test do
13
13
  { :start_rps => 600, :end_rps => 600, :duration => 60 }
14
14
  ]
15
15
 
16
- transaction 'Google Search' do
17
- visit 'Home Page', 'http://google.com/'
16
+ transaction name: 'Google Search' do
17
+ visit name: 'Home Page', url: 'http://google.com/'
18
18
  end
19
19
 
20
20
  end
21
- end.jmx
21
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -9,30 +9,30 @@ test do
9
9
 
10
10
  cookies
11
11
 
12
- threads 1, {:loops => 10} do
12
+ threads :count => 1, :loops => 10 do
13
13
 
14
14
  random_timer 1000, 3000
15
15
 
16
16
  transaction '01_etsy_home' do
17
- visit 'home', 'http://www.etsy.com/' do
18
- assert 'contains', 'Etsy - Your place to buy and sell all things handmade, vintage, and supplies'
17
+ visit :name => 'home', :url => 'http://www.etsy.com/' do
18
+ assert 'contains' => 'Etsy - Your place to buy and sell all things handmade, vintage, and supplies'
19
19
  end
20
20
  end
21
21
 
22
- once do
22
+ Once do
23
23
  transaction '02_etsy_signin' do
24
- submit 'signin', 'https://www.etsy.com/signin', {
24
+ submit :name => 'signin', :url => 'https://www.etsy.com/signin',
25
25
  :fill_in => {
26
- :username => 'tim.koops@gmail.com',
27
- :password => ARGV[0],
28
- :persistent => 1,
29
- :from_page => 'http://www.etsy.com/',
26
+ :username => 'tim.koops@gmail.com',
27
+ :password => ARGV[0],
28
+ :persistent => 1,
29
+ :from_page => 'http://www.etsy.com/',
30
30
  :from_action => '',
31
- :from_overlay => 1
32
- }
33
- } do
34
- assert 'contains', 'Tim'
35
- extract 'random_category', 'a href="(/browse.+?)"'
31
+ :from_name => '',
32
+ :overlay => 1
33
+ } do
34
+ assert 'contains' => 'Tim'
35
+ extract :regex => 'a href="(/browse.+?)"', :name => 'random_category'
36
36
  end
37
37
  end
38
38
  end
@@ -40,25 +40,25 @@ test do
40
40
  exists 'random_category' do
41
41
 
42
42
  transaction '03_etsy_browse_random_category' do
43
- visit 'browse', '${random_category}' do
44
- extract 'random_sub_category', 'a href="(http.+?subcat.+?)"'
43
+ visit :name => 'browse', :url => '${random_category}' do
44
+ extract :regex => 'a href="(http.+?subcat.+?)"', :name => 'random_sub_category'
45
45
  end
46
46
  end
47
47
 
48
48
  transaction '04_etsy_browse_random_sub_category' do
49
- visit 'browse', '${random_sub_category}' do
50
- extract 'random_listing', 'a href="(/listing.+?)"'
49
+ visit :name => 'browse', :url => '${random_sub_category}' do
50
+ extract :regex => 'a href="(/listing.+?)"', :name => 'random_listing'
51
51
  end
52
52
  end
53
53
 
54
54
  transaction '05_etsy_view_random_listing' do
55
- visit 'view', '${random_listing}'
55
+ visit :name => 'view', :url => '${random_listing}'
56
56
  end
57
57
 
58
58
  end
59
59
 
60
60
  end
61
61
 
62
- end.grid ARGV[1]
62
+ # end.grid ARGV[1]
63
63
  # end.jmx
64
- # end.run(path: '/usr/share/jmeter/bin/')
64
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)