jmeter-ruby 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 (266) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +22 -0
  3. data/.github/workflows/ci.yml +54 -0
  4. data/.gitignore +24 -0
  5. data/.rspec +1 -0
  6. data/.ruby-version +1 -0
  7. data/CHANGES.md +77 -0
  8. data/Gemfile +23 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +434 -0
  11. data/Rakefile +18 -0
  12. data/examples/OS_process_sampler.rb +24 -0
  13. data/examples/assertion_results.rb +18 -0
  14. data/examples/basic_auth.rb +11 -0
  15. data/examples/browser_headers.rb +7 -0
  16. data/examples/composite_graph.rb +29 -0
  17. data/examples/constant_throughput_timer.rb +11 -0
  18. data/examples/csv_data_set.rb +11 -0
  19. data/examples/dummy_sampler.rb +9 -0
  20. data/examples/duration_assertion.rb +10 -0
  21. data/examples/etsy_login_browse.rb +61 -0
  22. data/examples/extract.rb +12 -0
  23. data/examples/foreach_controller.rb +29 -0
  24. data/examples/header_manager.rb +29 -0
  25. data/examples/http_cache_manager.rb +11 -0
  26. data/examples/http_cookie_manager.rb +11 -0
  27. data/examples/http_request_defaults.rb +11 -0
  28. data/examples/http_request_post.rb +11 -0
  29. data/examples/http_request_with_files.rb +13 -0
  30. data/examples/http_request_with_query_params.rb +8 -0
  31. data/examples/jmeter_plugins_graphs.rb +22 -0
  32. data/examples/json_path_assertions.rb +11 -0
  33. data/examples/json_path_extractor.rb +10 -0
  34. data/examples/json_path_postprocessor.rb +10 -0
  35. data/examples/jsr223_assertion.rb +13 -0
  36. data/examples/ldap_sampler.rb +16 -0
  37. data/examples/loadosophia.rb +18 -0
  38. data/examples/loop_controller.rb +10 -0
  39. data/examples/loops_with_counter.rb +15 -0
  40. data/examples/once_only_controller.rb +15 -0
  41. data/examples/perfmon.rb +46 -0
  42. data/examples/real_custom_methods.rb +19 -0
  43. data/examples/real_page_objects.rb +41 -0
  44. data/examples/real_redis_data_set_with_setup.rb +123 -0
  45. data/examples/real_user_objects_github.rb +112 -0
  46. data/examples/regular_expression_extractor.rb +12 -0
  47. data/examples/response_assertion.rb +15 -0
  48. data/examples/response_time_percentiles_graph.rb +11 -0
  49. data/examples/rsync.rb +16 -0
  50. data/examples/sample_transaction.rb +18 -0
  51. data/examples/simple_data_writer_listener.rb +11 -0
  52. data/examples/stepping_thread_group.rb +30 -0
  53. data/examples/test_fragment.rb +14 -0
  54. data/examples/think_time.rb +15 -0
  55. data/examples/thread_groups.rb +7 -0
  56. data/examples/throughput_controller.rb +14 -0
  57. data/examples/throughput_shaping_timer.rb +20 -0
  58. data/examples/ultimate_thread_group.rb +39 -0
  59. data/examples/unicode.rb +8 -0
  60. data/examples/user_defined_variables.rb +10 -0
  61. data/examples/user_parameters.rb +28 -0
  62. data/examples/uuid_per_iteration.rb +15 -0
  63. data/jmeter-ruby.gemspec +28 -0
  64. data/lib/jmeter-ruby/DSL.md +235 -0
  65. data/lib/jmeter-ruby/dsl/access_log_sampler.rb +32 -0
  66. data/lib/jmeter-ruby/dsl/aggregate_graph.rb +55 -0
  67. data/lib/jmeter-ruby/dsl/aggregate_report.rb +55 -0
  68. data/lib/jmeter-ruby/dsl/ajp13_sampler.rb +41 -0
  69. data/lib/jmeter-ruby/dsl/assertion_results.rb +55 -0
  70. data/lib/jmeter-ruby/dsl/beanshell_assertion.rb +28 -0
  71. data/lib/jmeter-ruby/dsl/beanshell_listener.rb +28 -0
  72. data/lib/jmeter-ruby/dsl/beanshell_postprocessor.rb +28 -0
  73. data/lib/jmeter-ruby/dsl/beanshell_preprocessor.rb +28 -0
  74. data/lib/jmeter-ruby/dsl/beanshell_sampler.rb +28 -0
  75. data/lib/jmeter-ruby/dsl/beanshell_timer.rb +28 -0
  76. data/lib/jmeter-ruby/dsl/bsf_assertion.rb +28 -0
  77. data/lib/jmeter-ruby/dsl/bsf_listener.rb +28 -0
  78. data/lib/jmeter-ruby/dsl/bsf_postprocessor.rb +28 -0
  79. data/lib/jmeter-ruby/dsl/bsf_preprocessor.rb +28 -0
  80. data/lib/jmeter-ruby/dsl/bsf_sampler.rb +28 -0
  81. data/lib/jmeter-ruby/dsl/bsf_timer.rb +28 -0
  82. data/lib/jmeter-ruby/dsl/compare_assertion.rb +27 -0
  83. data/lib/jmeter-ruby/dsl/comparison_assertion_visualizer.rb +55 -0
  84. data/lib/jmeter-ruby/dsl/constant_throughput_timer.rb +26 -0
  85. data/lib/jmeter-ruby/dsl/constant_timer.rb +25 -0
  86. data/lib/jmeter-ruby/dsl/counter.rb +31 -0
  87. data/lib/jmeter-ruby/dsl/cssjquery_extractor.rb +31 -0
  88. data/lib/jmeter-ruby/dsl/csv_data_set_config.rb +33 -0
  89. data/lib/jmeter-ruby/dsl/debug_postprocessor.rb +28 -0
  90. data/lib/jmeter-ruby/dsl/debug_sampler.rb +27 -0
  91. data/lib/jmeter-ruby/dsl/distribution_graphalpha.rb +55 -0
  92. data/lib/jmeter-ruby/dsl/duration_assertion.rb +25 -0
  93. data/lib/jmeter-ruby/dsl/foreach_controller.rb +27 -0
  94. data/lib/jmeter-ruby/dsl/ftp_request.rb +34 -0
  95. data/lib/jmeter-ruby/dsl/ftp_request_defaults.rb +32 -0
  96. data/lib/jmeter-ruby/dsl/gaussian_random_timer.rb +26 -0
  97. data/lib/jmeter-ruby/dsl/generate_summary_results.rb +23 -0
  98. data/lib/jmeter-ruby/dsl/graph_results.rb +55 -0
  99. data/lib/jmeter-ruby/dsl/html_assertion.rb +30 -0
  100. data/lib/jmeter-ruby/dsl/html_link_parser.rb +23 -0
  101. data/lib/jmeter-ruby/dsl/html_parameter_mask.rb +32 -0
  102. data/lib/jmeter-ruby/dsl/http_authorization_manager.rb +33 -0
  103. data/lib/jmeter-ruby/dsl/http_cache_manager.rb +26 -0
  104. data/lib/jmeter-ruby/dsl/http_cookie_manager.rb +28 -0
  105. data/lib/jmeter-ruby/dsl/http_header_manager.rb +30 -0
  106. data/lib/jmeter-ruby/dsl/http_request.rb +41 -0
  107. data/lib/jmeter-ruby/dsl/http_request_defaults.rb +41 -0
  108. data/lib/jmeter-ruby/dsl/http_url_rewriting_modifier.rb +30 -0
  109. data/lib/jmeter-ruby/dsl/if_controller.rb +27 -0
  110. data/lib/jmeter-ruby/dsl/include_controller.rb +25 -0
  111. data/lib/jmeter-ruby/dsl/java_request.rb +69 -0
  112. data/lib/jmeter-ruby/dsl/java_request_defaults.rb +69 -0
  113. data/lib/jmeter-ruby/dsl/jdbc_connection_configuration.rb +37 -0
  114. data/lib/jmeter-ruby/dsl/jdbc_postprocessor.rb +33 -0
  115. data/lib/jmeter-ruby/dsl/jdbc_preprocessor.rb +33 -0
  116. data/lib/jmeter-ruby/dsl/jdbc_request.rb +33 -0
  117. data/lib/jmeter-ruby/dsl/jms_pointtopoint.rb +41 -0
  118. data/lib/jmeter-ruby/dsl/jms_publisher.rb +43 -0
  119. data/lib/jmeter-ruby/dsl/jms_subscriber.rb +35 -0
  120. data/lib/jmeter-ruby/dsl/json_path_postprocessor.rb +27 -0
  121. data/lib/jmeter-ruby/dsl/jsr223_assertion.rb +29 -0
  122. data/lib/jmeter-ruby/dsl/jsr223_listener.rb +29 -0
  123. data/lib/jmeter-ruby/dsl/jsr223_postprocessor.rb +29 -0
  124. data/lib/jmeter-ruby/dsl/jsr223_preprocessor.rb +29 -0
  125. data/lib/jmeter-ruby/dsl/jsr223_sampler.rb +29 -0
  126. data/lib/jmeter-ruby/dsl/jsr223_timer.rb +29 -0
  127. data/lib/jmeter-ruby/dsl/junit_request.rb +37 -0
  128. data/lib/jmeter-ruby/dsl/keystore_configuration.rb +28 -0
  129. data/lib/jmeter-ruby/dsl/ldap_extended_request.rb +42 -0
  130. data/lib/jmeter-ruby/dsl/ldap_extended_request_defaults.rb +42 -0
  131. data/lib/jmeter-ruby/dsl/ldap_request.rb +35 -0
  132. data/lib/jmeter-ruby/dsl/ldap_request_defaults.rb +39 -0
  133. data/lib/jmeter-ruby/dsl/login_config_element.rb +26 -0
  134. data/lib/jmeter-ruby/dsl/loop_controller.rb +26 -0
  135. data/lib/jmeter-ruby/dsl/mail_reader_sampler.rb +37 -0
  136. data/lib/jmeter-ruby/dsl/mailer_visualizer.rb +64 -0
  137. data/lib/jmeter-ruby/dsl/md5hex_assertion.rb +25 -0
  138. data/lib/jmeter-ruby/dsl/module_controller.rb +25 -0
  139. data/lib/jmeter-ruby/dsl/monitor_results.rb +55 -0
  140. data/lib/jmeter-ruby/dsl/once_only_controller.rb +23 -0
  141. data/lib/jmeter-ruby/dsl/os_process_sampler.rb +34 -0
  142. data/lib/jmeter-ruby/dsl/poisson_random_timer.rb +26 -0
  143. data/lib/jmeter-ruby/dsl/random_controller.rb +25 -0
  144. data/lib/jmeter-ruby/dsl/random_order_controller.rb +23 -0
  145. data/lib/jmeter-ruby/dsl/random_variable.rb +30 -0
  146. data/lib/jmeter-ruby/dsl/recording_controller.rb +23 -0
  147. data/lib/jmeter-ruby/dsl/regex_user_parameters.rb +27 -0
  148. data/lib/jmeter-ruby/dsl/regular_expression_extractor.rb +32 -0
  149. data/lib/jmeter-ruby/dsl/response_assertion.rb +31 -0
  150. data/lib/jmeter-ruby/dsl/response_time_graph.rb +55 -0
  151. data/lib/jmeter-ruby/dsl/result_status_action_handler.rb +25 -0
  152. data/lib/jmeter-ruby/dsl/runtime_controller.rb +25 -0
  153. data/lib/jmeter-ruby/dsl/save_responses_to_a_file.rb +29 -0
  154. data/lib/jmeter-ruby/dsl/setup_thread_group.rb +36 -0
  155. data/lib/jmeter-ruby/dsl/simple_config_element.rb +23 -0
  156. data/lib/jmeter-ruby/dsl/simple_controller.rb +23 -0
  157. data/lib/jmeter-ruby/dsl/simple_data_writer.rb +55 -0
  158. data/lib/jmeter-ruby/dsl/smime_assertion.rb +35 -0
  159. data/lib/jmeter-ruby/dsl/smtp_sampler.rb +51 -0
  160. data/lib/jmeter-ruby/dsl/soapxmlrpc_request.rb +33 -0
  161. data/lib/jmeter-ruby/dsl/spline_visualizer.rb +55 -0
  162. data/lib/jmeter-ruby/dsl/summary_report.rb +55 -0
  163. data/lib/jmeter-ruby/dsl/switch_controller.rb +25 -0
  164. data/lib/jmeter-ruby/dsl/synchronizing_timer.rb +26 -0
  165. data/lib/jmeter-ruby/dsl/tcp_sampler.rb +33 -0
  166. data/lib/jmeter-ruby/dsl/tcp_sampler_config.rb +31 -0
  167. data/lib/jmeter-ruby/dsl/test_action.rb +27 -0
  168. data/lib/jmeter-ruby/dsl/test_fragment.rb +23 -0
  169. data/lib/jmeter-ruby/dsl/test_plan.rb +31 -0
  170. data/lib/jmeter-ruby/dsl/thread_group.rb +37 -0
  171. data/lib/jmeter-ruby/dsl/throughput_controller.rb +32 -0
  172. data/lib/jmeter-ruby/dsl/transaction_controller.rb +26 -0
  173. data/lib/jmeter-ruby/dsl/uniform_random_timer.rb +26 -0
  174. data/lib/jmeter-ruby/dsl/user_defined_variables.rb +33 -0
  175. data/lib/jmeter-ruby/dsl/user_parameters.rb +30 -0
  176. data/lib/jmeter-ruby/dsl/view_results_in_table.rb +55 -0
  177. data/lib/jmeter-ruby/dsl/view_results_tree.rb +55 -0
  178. data/lib/jmeter-ruby/dsl/while_controller.rb +25 -0
  179. data/lib/jmeter-ruby/dsl/xml_assertion.rb +23 -0
  180. data/lib/jmeter-ruby/dsl/xml_schema_assertion.rb +25 -0
  181. data/lib/jmeter-ruby/dsl/xpath_assertion.rb +31 -0
  182. data/lib/jmeter-ruby/dsl/xpath_extractor.rb +31 -0
  183. data/lib/jmeter-ruby/dsl.rb +102 -0
  184. data/lib/jmeter-ruby/extend/assertions/response_assertion.rb +36 -0
  185. data/lib/jmeter-ruby/extend/config_elements/header_manager.rb +13 -0
  186. data/lib/jmeter-ruby/extend/config_elements/http_cache_manager.rb +12 -0
  187. data/lib/jmeter-ruby/extend/config_elements/http_cookie_manager.rb +36 -0
  188. data/lib/jmeter-ruby/extend/config_elements/http_request_defaults.rb +39 -0
  189. data/lib/jmeter-ruby/extend/config_elements/user_defined_variables.rb +13 -0
  190. data/lib/jmeter-ruby/extend/config_elements/user_parameters.rb +31 -0
  191. data/lib/jmeter-ruby/extend/controllers/foreach_controller.rb +27 -0
  192. data/lib/jmeter-ruby/extend/controllers/loop_controller.rb +11 -0
  193. data/lib/jmeter-ruby/extend/controllers/module_controller.rb +23 -0
  194. data/lib/jmeter-ruby/extend/controllers/throughput_controller.rb +15 -0
  195. data/lib/jmeter-ruby/extend/controllers/transaction_controller.rb +14 -0
  196. data/lib/jmeter-ruby/extend/misc/aliases.rb +21 -0
  197. data/lib/jmeter-ruby/extend/misc/exists.rb +13 -0
  198. data/lib/jmeter-ruby/extend/misc/rsync.rb +24 -0
  199. data/lib/jmeter-ruby/extend/misc/uuid.rb +12 -0
  200. data/lib/jmeter-ruby/extend/misc/with_helpers.rb +27 -0
  201. data/lib/jmeter-ruby/extend/plugins/jmeter_plugins.rb +120 -0
  202. data/lib/jmeter-ruby/extend/processors/extract.rb +28 -0
  203. data/lib/jmeter-ruby/extend/processors/regular_expression_extractor.rb +25 -0
  204. data/lib/jmeter-ruby/extend/samplers/http_request.rb +58 -0
  205. data/lib/jmeter-ruby/extend/samplers/jms_pointtopoint.rb +26 -0
  206. data/lib/jmeter-ruby/extend/samplers/soapxmlrpc_request.rb +9 -0
  207. data/lib/jmeter-ruby/extend/threads/setup_thread_group.rb +18 -0
  208. data/lib/jmeter-ruby/extend/threads/thread_group.rb +19 -0
  209. data/lib/jmeter-ruby/extend/timers/constant_throughput_timer.rb +11 -0
  210. data/lib/jmeter-ruby/extend/timers/random_timer.rb +14 -0
  211. data/lib/jmeter-ruby/helpers/fallback_content_proxy.rb +54 -0
  212. data/lib/jmeter-ruby/helpers/helper.rb +75 -0
  213. data/lib/jmeter-ruby/helpers/logger-colors.rb +48 -0
  214. data/lib/jmeter-ruby/helpers/parser.rb +135 -0
  215. data/lib/jmeter-ruby/helpers/strip-heredoc.rb +5 -0
  216. data/lib/jmeter-ruby/helpers/user-agents.rb +27 -0
  217. data/lib/jmeter-ruby/idl.rb +70 -0
  218. data/lib/jmeter-ruby/idl.xml +1488 -0
  219. data/lib/jmeter-ruby/plugins/active_threads_over_time.rb +57 -0
  220. data/lib/jmeter-ruby/plugins/composite_graph.rb +71 -0
  221. data/lib/jmeter-ruby/plugins/console_status_logger.rb +15 -0
  222. data/lib/jmeter-ruby/plugins/dummy_sampler.rb +26 -0
  223. data/lib/jmeter-ruby/plugins/jmx_collector.rb +73 -0
  224. data/lib/jmeter-ruby/plugins/json_path_assertion.rb +19 -0
  225. data/lib/jmeter-ruby/plugins/json_path_extractor.rb +20 -0
  226. data/lib/jmeter-ruby/plugins/latencies_over_time.rb +49 -0
  227. data/lib/jmeter-ruby/plugins/loadosophia_uploader.rb +63 -0
  228. data/lib/jmeter-ruby/plugins/perfmon_collector.rb +80 -0
  229. data/lib/jmeter-ruby/plugins/redis_data_set.rb +39 -0
  230. data/lib/jmeter-ruby/plugins/response_codes_per_second.rb +49 -0
  231. data/lib/jmeter-ruby/plugins/response_times_distribution.rb +49 -0
  232. data/lib/jmeter-ruby/plugins/response_times_over_time.rb +50 -0
  233. data/lib/jmeter-ruby/plugins/response_times_percentiles.rb +51 -0
  234. data/lib/jmeter-ruby/plugins/stepping_thread_group.rb +30 -0
  235. data/lib/jmeter-ruby/plugins/transactions_per_second.rb +50 -0
  236. data/lib/jmeter-ruby/plugins/ultimate_thread_group.rb +23 -0
  237. data/lib/jmeter-ruby/plugins/variable_throughput_timer.rb +27 -0
  238. data/lib/jmeter-ruby/version.rb +12 -0
  239. data/lib/jmeter-ruby.rb +27 -0
  240. data/mise.toml +2 -0
  241. data/script/release +162 -0
  242. data/spec/constant_throughput_timer_spec.rb +20 -0
  243. data/spec/csv_data_set_config_spec.rb +33 -0
  244. data/spec/header_manager_spec.rb +37 -0
  245. data/spec/http_cache_manager_spec.rb +29 -0
  246. data/spec/http_cookie_manager_spec.rb +169 -0
  247. data/spec/http_request_defaults_spec.rb +57 -0
  248. data/spec/http_request_spec.rb +305 -0
  249. data/spec/jmeter_plugins_spec.rb +245 -0
  250. data/spec/json_extractor_spec.rb +19 -0
  251. data/spec/json_path_assertion_spec.rb +28 -0
  252. data/spec/logic_controller_spec.rb +148 -0
  253. data/spec/loop_controller_spec.rb +19 -0
  254. data/spec/module_controller_spec.rb +56 -0
  255. data/spec/regular_expression_extractor_spec.rb +63 -0
  256. data/spec/response_assertion_spec.rb +69 -0
  257. data/spec/setup_thread_group_spec.rb +31 -0
  258. data/spec/spec_helper.rb +19 -0
  259. data/spec/thread_group_spec.rb +57 -0
  260. data/spec/throughput_controller_spec.rb +24 -0
  261. data/spec/transaction_controller_spec.rb +30 -0
  262. data/spec/user_defined_variables_spec.rb +22 -0
  263. data/spec/user_parameters_spec.rb +45 -0
  264. data/spec/with_helpers_spec.rb +57 -0
  265. data/spec/xpath_extractor_spec.rb +15 -0
  266. metadata +360 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b6e3df6308fba625f6639be81d7f74a2703b6f31d8a38907620f43c8361e308a
4
+ data.tar.gz: 3f878f2afa7e83c5a2975c6682719d133136d322511c924863502ebdb18afadd
5
+ SHA512:
6
+ metadata.gz: c23624b52ea012efbd7ca96352992ac4a6efc77f4291e673f5bfb94b07f0cc29383dcefb52dc3fee3655c9c06c8a35732e7ddc306f4ef9bd0788b79725c64ab2
7
+ data.tar.gz: ca7bf82218e82adf99bde069851a900ec830e1c37c0f65bf8391f23016d2cb92cff075f503eb4fa91bb2e1fefb5b90bfa2108a72e6999241ac9378d7d6bead31
data/.gitattributes ADDED
@@ -0,0 +1,22 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
3
+
4
+ # Custom for Visual Studio
5
+ *.cs diff=csharp
6
+ *.sln merge=union
7
+ *.csproj merge=union
8
+ *.vbproj merge=union
9
+ *.fsproj merge=union
10
+ *.dbproj merge=union
11
+
12
+ # Standard to msysgit
13
+ *.doc diff=astextplain
14
+ *.DOC diff=astextplain
15
+ *.docx diff=astextplain
16
+ *.DOCX diff=astextplain
17
+ *.dot diff=astextplain
18
+ *.DOT diff=astextplain
19
+ *.pdf diff=astextplain
20
+ *.PDF diff=astextplain
21
+ *.rtf diff=astextplain
22
+ *.RTF diff=astextplain
@@ -0,0 +1,54 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ test:
11
+ name: test ruby-${{ matrix.ruby_version }}
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ include:
17
+ - ruby_version: "3.2"
18
+ - ruby_version: "3.3"
19
+ - ruby_version: "3.4"
20
+ steps:
21
+ - uses: actions/checkout@v4.1.1
22
+ - name: Setup Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby_version }}
26
+ bundler-cache: true
27
+ - name: Build and test with Rake
28
+ run: |
29
+ MEASURE_COVERAGE=true bundle exec rspec
30
+ env:
31
+ RAISE_ON_WARNING: 1
32
+ RUBY_VERSION: ${{ matrix.ruby_version }}
33
+ - name: Upload coverage results
34
+ uses: actions/upload-artifact@v4.4.0
35
+ if: always()
36
+ with:
37
+ name: simplecov-resultset-ruby${{matrix.ruby_version}}
38
+ path: coverage
39
+ include-hidden-files: true
40
+ coverage:
41
+ needs: test
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/checkout@v4.1.1
45
+ - name: Setup Ruby
46
+ uses: ruby/setup-ruby@v1
47
+ with:
48
+ ruby-version: 3.4
49
+ bundler-cache: true
50
+ - name: Download coverage results
51
+ uses: actions/download-artifact@v4.2.1
52
+ - name: Collate simplecov
53
+ run: |
54
+ bundle exec rake coverage:report
data/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .idea
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ *.log
20
+ *.jmx
21
+ *.jtl
22
+ *.bak
23
+ .byebug_history
24
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.7
data/CHANGES.md ADDED
@@ -0,0 +1,77 @@
1
+ # Changes
2
+ ## v3.0.0
3
+ - Add Github Actions CI
4
+ - Add support foir modern Rubies
5
+ - Add code coverage
6
+ - Remove Flood io
7
+ - Rename to jmeter-ruby
8
+
9
+ ## v2.13.2
10
+
11
+ - Support for Loadosophia plugin
12
+
13
+ ## v2.13.0
14
+
15
+ - Update to JMeter 2.13
16
+
17
+ ## v2.11.11
18
+
19
+ - Support for `test_fragment` for use with the `module_controller`. [See example here](https://github.com/flood-io/ruby-jmeter/blob/master/examples/basic_test_fragment.rb).
20
+
21
+ ## v2.11.5
22
+
23
+ - HTTP Request Defaults now have more intuitive key names:
24
+
25
+ ```ruby
26
+ defaults domain: 'example.com',
27
+ protocol: 'https',
28
+ download_resources: true,
29
+ use_concurrent_pool: 5,
30
+ urls_must_match: 'http.+?example.com'
31
+ ```
32
+
33
+ - There's a new `with_gzip` header manager alias:
34
+
35
+ ```ruby
36
+ test do
37
+ threads do
38
+ transaction name: "TC_02", parent: true, include_timers: true do
39
+ visit url: "/" do
40
+ with_gzip
41
+ end
42
+ end
43
+ end
44
+ end
45
+ ```
46
+
47
+ - There's a new `test_data` helper method to simplify getting test data from the flood.io shared data URL. Including ability to stub, set defaults, get all values or explicit values :
48
+
49
+ ```ruby
50
+ test do
51
+ threads 1 do
52
+
53
+ # populate ${testdata} array with all results from shared data url
54
+ test_data 'http://54.252.206.143:8080/SRANDMEMBER/postcodes?type=text'
55
+
56
+ # populate named ${postcodes} array with all results from shared data url
57
+ test_data url: 'http://54.252.206.143:8080/SRANDMEMBER/postcodes?type=text',
58
+ name: 'postcodes'
59
+
60
+ # populate named ${postcode} with random result from shared data url
61
+ test_data url: 'http://54.252.206.143:8080/SRANDMEMBER/postcodes?type=text',
62
+ name: 'postcode_random', match_num: 0
63
+
64
+
65
+ # populate named ${postcode} with exact match from shared data url
66
+ test_data url: 'http://54.252.206.143:8080/SRANDMEMBER/postcodes?type=text',
67
+ name: 'postcode_exact', regex: '^(\d+)', match_num: 1
68
+
69
+ # populate named ${postcode} with exact match from a stubbed data url
70
+ test_data url: 'http://54.252.206.143:8080/SRANDMEMBER/postcodes?type=text',
71
+ name: 'postcode_stub', regex: '^(\d+)', match_num: 1, default: '2010', stub: true
72
+
73
+ debug_sampler
74
+ view_results
75
+ end
76
+ end.run(path: '/usr/share/jmeter-2.13/bin/', gui: true)
77
+ ```
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jmeter-ruby.gemspec
4
+ gemspec
5
+
6
+ gem 'nokogiri'
7
+ gem 'rest-client'
8
+ gem 'json'
9
+
10
+ platforms :jruby do
11
+ gem 'json-jruby'
12
+ end
13
+
14
+ group :development do
15
+ gem 'byebug'
16
+ end
17
+
18
+ group :test do
19
+ gem 'rake'
20
+ gem 'rspec'
21
+ gem 'sinatra'
22
+ gem 'haml'
23
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2025 Reegan Viljoen
2
+ MIT License
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,434 @@
1
+ # jmeter-ruby
2
+ > **JMeter-Ruby** is a fork of the now defunk **Ruby-JMeter** that was built and maintained by Flood IO, this gem intends to be continaution of ruby-jmeter that is actievly maintained
3
+
4
+ Tired of using the JMeter GUI or looking at hairy XML files?
5
+
6
+ This gem lets you write test plans for JMeter in your favourite text editor.
7
+
8
+ ## Installation
9
+
10
+ Install it yourself as:
11
+
12
+ $ gem install jmeter-ruby
13
+
14
+ ## Basic Usage
15
+
16
+ *JmeterRuby* exposes easy-to-use domain specific language for fluent communication with [JMeter](http://jmeter.apache.org/).
17
+
18
+ To use the DSL, first let's require the gem:
19
+
20
+ ```ruby
21
+ require 'jmeter-ruby'
22
+ ```
23
+
24
+ ### Basic Example
25
+ Let's create a `test` and save the related `jmx` testplan to file, so we can edit/view it in JMeter.
26
+
27
+ ```ruby
28
+ test do
29
+ threads count: 10 do
30
+ visit name: 'Google Search', url: 'http://google.com'
31
+ end
32
+ end.jmx
33
+ ```
34
+
35
+ So in this example, we just created a test plan, with 10 threads, each of which visited the search page at Google.
36
+
37
+ ### Generating a JMeter Test Plan (JMX)
38
+ Note also how we called the `jmx` method of the test. Calling this method will write the contents of the JMeter test plan to file like this.
39
+
40
+ ```
41
+ $ ruby testplan.rb
42
+ [2013-04-23T10:29:03.275743 #42060] INFO -- : Test plan saved to: jmeter.jmx
43
+ ```
44
+
45
+ ```xml
46
+ <?xml version="1.0" encoding="UTF-8"?>
47
+ <jmeterTestPlan version="1.2" properties="2.1">
48
+ <hashTree>
49
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
50
+ ...
51
+ </TestPlan>
52
+ </hashTree>
53
+ </jmeterTestPlan>
54
+ JMX saved to: jmeter.jmx
55
+ ```
56
+
57
+ The file that is created can then be executed in the JMeter GUI. If you want to create the file with a different filename and/or path, just add the `file` parameter to the `jmx` method call like this.
58
+
59
+ ```ruby
60
+ test do
61
+ threads count: 10 do
62
+ visit name: 'Google Search', url: 'http://google.com'
63
+ end
64
+ end.jmx(file: "/tmp/my_testplan.jmx")
65
+ ```
66
+
67
+ Windows users should specify a path like this.
68
+
69
+ ```ruby
70
+ .jmx(file: "C:\\TEMP\\MyTestplan.jmx")
71
+ ```
72
+
73
+ ### Running a JMeter Test Plan locally
74
+ You can execute the JMeter test plan by calling the `run` method of the test like this.
75
+
76
+ ```ruby
77
+ test do
78
+ threads count: 10 do
79
+ visit name: 'Google Search', url: 'http://google.com'
80
+ end
81
+ end.run
82
+ ```
83
+
84
+ This will launch JMeter in headless (non-GUI mode) and execute the test plan. This is useful for shaking out the script before you push it to the Grid. There are a few parameters that you can set such as the `path` to the JMeter binary, the `file` path/name for the JMX file, the `log` path/name to output JMeter logs, the `jtl` path/name for JMeter results like this, and the `properties` path/name for the additional JMeter property file.
85
+
86
+ ```ruby
87
+ test do
88
+ threads count: 10 do
89
+ visit name: 'Google Search', url: 'http://google.com'
90
+ end
91
+ end.run(
92
+ path: '/usr/share/jmeter/bin/',
93
+ file: 'jmeter.jmx',
94
+ log: 'jmeter.log',
95
+ jtl: 'results.jtl',
96
+ properties: 'jmeter.properties')
97
+ ```
98
+
99
+ ## Advanced Usage
100
+
101
+ ### Blocks
102
+
103
+ Each of the methods take an optional block delimited by `do` and `end` or braces `{}`
104
+
105
+ Blocks let you nest methods within methods, so you can scope the execution of methods as you would in a normal JMeter test plan. For example.
106
+
107
+ ```ruby
108
+ test do
109
+ threads count: 100 do
110
+ visit name: 'Home', url: 'http://altentee.com' do
111
+ extract regex: "content='(.+?)' name='csrf-token'", name: 'csrf-token'
112
+ end
113
+ end
114
+ end
115
+ ```
116
+
117
+ This would create a new test plan, with a 100 user thread group, each user visiting the "Home" page and extracting the CSRF token from the response of each visit.
118
+
119
+ 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.
120
+
121
+ All methods take a parameter hash to configure related options.
122
+
123
+ ### Threads
124
+
125
+ You can use the `threads` method to define a group of users:
126
+
127
+ ```ruby
128
+ threads count: 100
129
+ threads count: 100, continue_forever: true
130
+ threads count: 100, loops: 10
131
+ threads count: 100, rampup: 30, duration: 60
132
+ threads count: 100, scheduler: true,
133
+ start_time: Time.now.to_i * 1000,
134
+ end_time: (Time.now.to_i * 1000) + (3600 * 1000)
135
+ ```
136
+
137
+ ### Cookies
138
+
139
+ You can use the `cookies` method to define a Cookie Manager:
140
+
141
+ ```ruby
142
+ test do
143
+ cookies
144
+ end
145
+ ```
146
+
147
+ This methods takes an optional parameters hash. This is based on the [HTTP Cookie Manager](http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cookie_Manager).
148
+
149
+ ```ruby
150
+ test do
151
+ cookies clear_each_iteration: false
152
+ end
153
+
154
+ test do
155
+ cookies policy: 'rfc2109', clear_each_iteration: true
156
+ end
157
+ ```
158
+
159
+ #### User-Defined Cookies
160
+
161
+ The `cookies` method parameters hash supports `user_defined_cookies`:
162
+
163
+ ```ruby
164
+ test do
165
+ cookie1 = { value: 'foo', name: 'bar', domain: 'google.co.uk', path: '/' }
166
+ cookie2 = { value: 'hello', name: 'world', domain: 'google.co.uk', secure: true }
167
+
168
+ cookies user_defined_cookies: [ cookie1, cookie2 ]
169
+ end
170
+ ```
171
+
172
+ `name` and `value` are required. `domain` and `path` are optional and default to blank.
173
+ `secure` is optional and defaults to `false`.
174
+
175
+ ### Cache
176
+
177
+ You can use the `cache` method to define a Cache Manager:
178
+
179
+ ```ruby
180
+ test do
181
+ cache
182
+ end
183
+ ```
184
+
185
+ This methods takes an optional parameters hash. This is based on the [HTTP Cache Manager](http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cache_Manager).
186
+
187
+ ```ruby
188
+ test do
189
+ cache clear_each_iteration: false
190
+ end
191
+
192
+ test do
193
+ cache use_expires: true, clear_each_iteration: true
194
+ end
195
+ ```
196
+
197
+ ### Authorization
198
+
199
+ You can use the `auth` method to define an Authorization Manager:
200
+
201
+ ```ruby
202
+ test do
203
+ auth
204
+ end
205
+ ```
206
+
207
+ This methods takes an optional parameters hash. This is based on the [HTTP Authorization Manager](http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Authorization_Manager).
208
+
209
+ ```ruby
210
+ test do
211
+ auth url: '/', username: 'tim', password: 'secret', domain: 'altentee.com'
212
+ end
213
+ ```
214
+
215
+ ### Navigating
216
+
217
+ You can use the `visit` method to navigate to pages:
218
+
219
+ ```ruby
220
+ visit name: 'Google Search', url: 'http://google.com'
221
+ visit name: 'Google Search', url: 'http://google.com'
222
+ visit name: 'Google Search', url: 'http://google.com',
223
+ method: 'POST',
224
+ 'DO_MULTIPART_POST': 'true'
225
+ visit name: 'Google Search', url: 'http://google.com',
226
+ use_keepalive: 'false'
227
+ visit name: 'Google Search', url: 'http://google.com',
228
+ connect_timeout: '1000',
229
+ response_timeout: '60000'
230
+ visit name: 'View Login', url: '/login',
231
+ protocol: "https",
232
+ port: 443
233
+ ```
234
+
235
+ ### Submitting a Form
236
+
237
+ You can use the `submit` method to POST a HTTP form:
238
+
239
+ ```ruby
240
+ submit name: 'Submit Form', url: 'http://altentee.com/',
241
+ fill_in: {
242
+ username: 'tim',
243
+ password: 'password',
244
+ 'csrf-token' => '${csrf-token}'
245
+ }
246
+ ```
247
+
248
+ 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.
249
+
250
+ ### POST JSON
251
+
252
+ ```ruby
253
+ header [
254
+ { name: 'Content-Type', value: 'application/json' }
255
+ ]
256
+
257
+ person = { name: "Tom" }
258
+
259
+ post name: 'Create Person',
260
+ url: "https://example.com/people.json",
261
+ raw_body: person.to_json do
262
+ with_xhr
263
+ end
264
+ ```
265
+
266
+ ### Think Time
267
+
268
+ You can use the `think_time` method to insert pauses into the simulation. This method is aliased as `random_timer`.
269
+
270
+ ```ruby
271
+ think_time 3000
272
+ ```
273
+
274
+ This method takes 2 parameters: the constant delay, and an optional variable delay. Both are specified in milliseconds. This is based on the [Gaussian Random Timer](http://jmeter.apache.org/usermanual/component_reference.html#Gaussian_Random_Timer). This timer pauses each thread request for a random amount of time, with most of the time intervals ocurring near a particular value. The total delay is the sum of the Gaussian distributed value (with mean 0.0 and standard deviation 1.0) times the deviation value you specify, and the offset value.
275
+
276
+ ```ruby
277
+ # constant delay of 3 seconds
278
+ think_time 3000
279
+ # constant delay of 1 seconds with variance up to 6 seconds.
280
+ random_timer 1000, 6000
281
+ ```
282
+
283
+ ### Response Extractor
284
+
285
+ 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.
286
+
287
+ ```ruby
288
+ extract regex: "content='(.+?)' name='csrf-token'", name: 'csrf-token'
289
+
290
+ visit name: 'Google', url: "http://google.com/" do
291
+ extract regex: 'aria-label="(.+?)"', name: 'button_text'
292
+ extract xpath: '//button', name: 'button'
293
+ end
294
+ ```
295
+
296
+ 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)
297
+
298
+ ```ruby
299
+ visit name: "Altentee", url: "http://altentee.com" do
300
+ extract regex: "content='(.+?)' name='csrf-token'", name: 'csrf-token'
301
+ extract regex: 'value="(.+?)" name="JESSIONSID"', name: 'JSESSIONID'
302
+ web_reg_save_param regex: 'value="(.+?)" name="VIEWSTATE"', name: 'VIEWSTATE'
303
+ extract name: 'username', regex: 'value="(.+?)", name="username"',
304
+ default: 'Tim Koopmans',
305
+ match_number: 1
306
+ extract name: 'shopping_item', regex: 'id="(.+?)" name="book"',
307
+ match_number: 0 # random
308
+ end
309
+ ```
310
+ You can later use the extracted values with subsequent requests:
311
+
312
+ ```ruby
313
+ post name: 'Authenticate', url: 'http://example.com/api/authentication/facebook', raw_body: '{"auth_token": "FB_TOKEN"}' do
314
+ extract name: 'auth_token', regex: %q{.*"token":"([^"]+)".*}
315
+ extract name: 'user_id', regex: %q{.*"user_id":([^,]+),.*}
316
+ end
317
+
318
+ header({name: 'X-Auth-Token', value: '${auth_token}'})
319
+ visit name: 'User profile', url: 'http://example.com/api/users/${user_id}'
320
+ ```
321
+
322
+ ### Response Assertion
323
+
324
+ You can use the `assert` method to extract values from a server response using a regular expression. This is aliased as the `web_reg_find` method. This method is typically used inside a `visit` or `submit` block.
325
+
326
+ ```ruby
327
+ visit "Altentee", "http://altentee.com" do
328
+ assert contains: "We test, tune and secure your site"
329
+ end
330
+ ```
331
+
332
+
333
+ This method takes 3 parameters: the matching rule, the test string, and an optional parameters hash. This is based on the [Response Assertion](http://jmeter.apache.org/usermanual/component_reference.html#Response_Assertion).
334
+
335
+ ```ruby
336
+ 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'
343
+ end
344
+ ```
345
+
346
+ ## Roadmap
347
+
348
+ This project is not being sposred by anyone curently but is being maintained. Get in touch with us if you'd like to be involved.
349
+
350
+
351
+
352
+ ## Contributing
353
+
354
+ 1. Fork it
355
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
356
+ 3. Create some specs, make them pass
357
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
358
+ 5. Push to the branch (`git push origin my-new-feature`)
359
+ 6. Create new Pull Request
360
+
361
+ ### IDL
362
+
363
+ We use an interface description language (IDL) as a bridge between JMeter's components expressed as XML in a `.jmx` test plan to Ruby's DSL objects in this repository.
364
+
365
+ To automate this `lib/jmeter-ruby/idl.rb` can be executed from the command line which will read from `lib/jmeter-ruby/idl.xml` and output to `lib/jmeter-ruby/dsl`
366
+
367
+ For example:
368
+
369
+ ```sh
370
+ flood/jmeter-ruby - [master●] » ruby lib/jmeter-ruby/idl.rb
371
+ flood/jmeter-ruby - [master●] » git status
372
+ On branch master
373
+ Your branch is up-to-date with 'origin/master'.
374
+ Changes not staged for commit:
375
+ (use "git add <file>..." to update what will be committed)
376
+ (use "git checkout -- <file>..." to discard changes in working directory)
377
+
378
+ modified: lib/jmeter-ruby/DSL.md
379
+ modified: lib/jmeter-ruby/dsl/foreach_controller.rb
380
+ modified: lib/jmeter-ruby/dsl/http_request.rb
381
+ modified: lib/jmeter-ruby/dsl/http_request_defaults.rb
382
+ modified: lib/jmeter-ruby/dsl/regular_expression_extractor.rb
383
+ modified: lib/jmeter-ruby/dsl/response_assertion.rb
384
+ modified: lib/jmeter-ruby/dsl/test_fragment.rb
385
+ modified: lib/jmeter-ruby/dsl/user_parameters.rb
386
+ ```
387
+
388
+ You **should never manually update** code in `lib/jmeter-ruby/dsl` as this is automatically overwritten whenever we run the IDL script. As new components / plugins are added, or major versions of JMeter are updated, we open `lib/jmeter-ruby/idl.xml` in the JMeter UI with those updates prior to running the IDL script. This makes updating between versions more easy.
389
+
390
+ ### DSL
391
+
392
+ Much of the behaviour of the gem is defined in `lib/jmeter-ruby/dsl.rb` which is where you should be updating code. You can extend individual DSL component behaviour in `live/jmeter-ruby/extend/**/*.rb`
393
+
394
+ ### Plugins
395
+
396
+ Some custom code has been contributed particularly for support of JMeter plugins. These are not included in the IDL and as such should be added to `lib/jmeter-ruby/plugins`. Please follow some of the other examples.
397
+
398
+ ### Bundler
399
+
400
+ We recommend using the Ruby gem bundle to manage your dependencies. Typical setup would be:
401
+
402
+
403
+ ```sh
404
+ gem install bundler
405
+ cd <your local clone>
406
+ bundle install
407
+ ```
408
+
409
+ Then you can run any rake / test tasks with the prefix `bundle exec`
410
+
411
+ ### Tests
412
+
413
+ If contributing please add an appropriate test. See `spec/*_spec.rb` for examples. Tests can be run from the command line as follows:
414
+
415
+ $ bundle exec rspec
416
+
417
+ ### Examples
418
+
419
+ It is often useful to add an appropriate example for other users and for testing your changes locally with the JMeter UI. See `examples` for different types of examples. To let your examples work locally from your own changes / commits simply prefix the examples with:
420
+
421
+ ```ruby
422
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
423
+ ```
424
+
425
+ $ flood/jmeter-ruby - [master●] » ruby examples/basic_assertion.rb
426
+ W, [2015-10-17T19:31:12.021004 #33216] WARN -- : Test executing locally ...
427
+
428
+ Note: most of the examples assume the JMeter binary is installed in `/usr/share/jmeter/bin/` however you can modify this in your example to something that suits your installation e.g.:
429
+
430
+
431
+ ```ruby
432
+ ...
433
+ end.run(path: 'C/Program Files/JMeter/bin/', gui: true)
434
+ ```
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ require 'bundler/gem_tasks'
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ namespace :coverage do
6
+ task :report do
7
+ require "simplecov"
8
+ require "simplecov-console"
9
+
10
+ SimpleCov.minimum_coverage 75
11
+
12
+ SimpleCov.collate Dir["{coverage,simplecov-resultset-*}/.resultset.json"] do
13
+ formatter SimpleCov::Formatter::Console
14
+ end
15
+ end
16
+ end
17
+
18
+ task default: [:spec]