ruby-jmeter 2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +22 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/Gemfile +27 -0
- data/LICENSE.txt +22 -0
- data/README.md +333 -0
- data/Rakefile +6 -0
- data/bin/grid +25 -0
- data/examples/basic_assertion.rb +13 -0
- data/examples/basic_auth.rb +11 -0
- data/examples/basic_cache.rb +11 -0
- data/examples/basic_cookies.rb +11 -0
- data/examples/basic_extract.rb +10 -0
- data/examples/basic_gc_dummy_sampler.rb +10 -0
- data/examples/basic_gc_results.rb +23 -0
- data/examples/basic_google.rb +8 -0
- data/examples/basic_grid.rb +8 -0
- data/examples/basic_header.rb +19 -0
- data/examples/basic_ldap_ext.rb +16 -0
- data/examples/basic_post.rb +15 -0
- data/examples/basic_query_params.rb +8 -0
- data/examples/basic_think_time.rb +15 -0
- data/examples/basic_throughput_controller.rb +14 -0
- data/examples/basic_throughput_shaping_timer.rb +21 -0
- data/examples/etsy_login_browse.rb +64 -0
- data/lib/ruby-jmeter.rb +18 -0
- data/lib/ruby-jmeter/DSL.md +237 -0
- data/lib/ruby-jmeter/dsl.rb +419 -0
- data/lib/ruby-jmeter/dsl/access_log_sampler.rb +32 -0
- data/lib/ruby-jmeter/dsl/aggregate_graph.rb +55 -0
- data/lib/ruby-jmeter/dsl/aggregate_report.rb +55 -0
- data/lib/ruby-jmeter/dsl/ajp13_sampler.rb +41 -0
- data/lib/ruby-jmeter/dsl/assertion_results.rb +55 -0
- data/lib/ruby-jmeter/dsl/beanshell_assertion.rb +28 -0
- data/lib/ruby-jmeter/dsl/beanshell_listener.rb +28 -0
- data/lib/ruby-jmeter/dsl/beanshell_postprocessor.rb +28 -0
- data/lib/ruby-jmeter/dsl/beanshell_preprocessor.rb +28 -0
- data/lib/ruby-jmeter/dsl/beanshell_sampler.rb +28 -0
- data/lib/ruby-jmeter/dsl/beanshell_timer.rb +28 -0
- data/lib/ruby-jmeter/dsl/bsf_assertion.rb +28 -0
- data/lib/ruby-jmeter/dsl/bsf_listener.rb +28 -0
- data/lib/ruby-jmeter/dsl/bsf_postprocessor.rb +28 -0
- data/lib/ruby-jmeter/dsl/bsf_preprocessor.rb +28 -0
- data/lib/ruby-jmeter/dsl/bsf_sampler.rb +28 -0
- data/lib/ruby-jmeter/dsl/bsf_timer.rb +28 -0
- data/lib/ruby-jmeter/dsl/compare_assertion.rb +27 -0
- data/lib/ruby-jmeter/dsl/comparison_assertion_visualizer.rb +55 -0
- data/lib/ruby-jmeter/dsl/constant_throughput_timer.rb +30 -0
- data/lib/ruby-jmeter/dsl/constant_timer.rb +25 -0
- data/lib/ruby-jmeter/dsl/counter.rb +31 -0
- data/lib/ruby-jmeter/dsl/cssjquery_extractor.rb +30 -0
- data/lib/ruby-jmeter/dsl/csv_data_set_config.rb +32 -0
- data/lib/ruby-jmeter/dsl/debug_postprocessor.rb +28 -0
- data/lib/ruby-jmeter/dsl/debug_sampler.rb +27 -0
- data/lib/ruby-jmeter/dsl/distribution_graphalpha.rb +55 -0
- data/lib/ruby-jmeter/dsl/duration_assertion.rb +25 -0
- data/lib/ruby-jmeter/dsl/foreach_controller.rb +29 -0
- data/lib/ruby-jmeter/dsl/ftp_request.rb +34 -0
- data/lib/ruby-jmeter/dsl/ftp_request_defaults.rb +32 -0
- data/lib/ruby-jmeter/dsl/gaussian_random_timer.rb +26 -0
- data/lib/ruby-jmeter/dsl/generate_summary_results.rb +23 -0
- data/lib/ruby-jmeter/dsl/graph_results.rb +55 -0
- data/lib/ruby-jmeter/dsl/html_assertion.rb +30 -0
- data/lib/ruby-jmeter/dsl/html_link_parser.rb +23 -0
- data/lib/ruby-jmeter/dsl/html_parameter_mask.rb +32 -0
- data/lib/ruby-jmeter/dsl/http_authorization_manager.rb +33 -0
- data/lib/ruby-jmeter/dsl/http_cache_manager.rb +26 -0
- data/lib/ruby-jmeter/dsl/http_cookie_manager.rb +27 -0
- data/lib/ruby-jmeter/dsl/http_header_manager.rb +30 -0
- data/lib/ruby-jmeter/dsl/http_request.rb +41 -0
- data/lib/ruby-jmeter/dsl/http_request_defaults.rb +44 -0
- data/lib/ruby-jmeter/dsl/http_url_rewriting_modifier.rb +29 -0
- data/lib/ruby-jmeter/dsl/if_controller.rb +27 -0
- data/lib/ruby-jmeter/dsl/include_controller.rb +25 -0
- data/lib/ruby-jmeter/dsl/java_request.rb +69 -0
- data/lib/ruby-jmeter/dsl/java_request_defaults.rb +69 -0
- data/lib/ruby-jmeter/dsl/jdbc_connection_configuration.rb +37 -0
- data/lib/ruby-jmeter/dsl/jdbc_postprocessor.rb +31 -0
- data/lib/ruby-jmeter/dsl/jdbc_preprocessor.rb +31 -0
- data/lib/ruby-jmeter/dsl/jdbc_request.rb +31 -0
- data/lib/ruby-jmeter/dsl/jms_pointtopoint.rb +40 -0
- data/lib/ruby-jmeter/dsl/jms_publisher.rb +41 -0
- data/lib/ruby-jmeter/dsl/jms_subscriber.rb +35 -0
- data/lib/ruby-jmeter/dsl/jsr223_assertion.rb +29 -0
- data/lib/ruby-jmeter/dsl/jsr223_listener.rb +29 -0
- data/lib/ruby-jmeter/dsl/jsr223_postprocessor.rb +29 -0
- data/lib/ruby-jmeter/dsl/jsr223_preprocessor.rb +29 -0
- data/lib/ruby-jmeter/dsl/jsr223_sampler.rb +29 -0
- data/lib/ruby-jmeter/dsl/jsr223_timer.rb +29 -0
- data/lib/ruby-jmeter/dsl/junit_request.rb +37 -0
- data/lib/ruby-jmeter/dsl/keystore_configuration.rb +27 -0
- data/lib/ruby-jmeter/dsl/ldap_extended_request.rb +42 -0
- data/lib/ruby-jmeter/dsl/ldap_extended_request_defaults.rb +42 -0
- data/lib/ruby-jmeter/dsl/ldap_request.rb +35 -0
- data/lib/ruby-jmeter/dsl/ldap_request_defaults.rb +40 -0
- data/lib/ruby-jmeter/dsl/login_config_element.rb +26 -0
- data/lib/ruby-jmeter/dsl/loop_controller.rb +26 -0
- data/lib/ruby-jmeter/dsl/mail_reader_sampler.rb +37 -0
- data/lib/ruby-jmeter/dsl/mailer_visualizer.rb +64 -0
- data/lib/ruby-jmeter/dsl/md5hex_assertion.rb +25 -0
- data/lib/ruby-jmeter/dsl/module_controller.rb +23 -0
- data/lib/ruby-jmeter/dsl/monitor_results.rb +55 -0
- data/lib/ruby-jmeter/dsl/once_only_controller.rb +23 -0
- data/lib/ruby-jmeter/dsl/os_process_sampler.rb +34 -0
- data/lib/ruby-jmeter/dsl/poisson_random_timer.rb +26 -0
- data/lib/ruby-jmeter/dsl/random_controller.rb +25 -0
- data/lib/ruby-jmeter/dsl/random_order_controller.rb +23 -0
- data/lib/ruby-jmeter/dsl/random_variable.rb +30 -0
- data/lib/ruby-jmeter/dsl/recording_controller.rb +23 -0
- data/lib/ruby-jmeter/dsl/regex_user_parameters.rb +27 -0
- data/lib/ruby-jmeter/dsl/regular_expression_extractor.rb +31 -0
- data/lib/ruby-jmeter/dsl/response_assertion.rb +31 -0
- data/lib/ruby-jmeter/dsl/response_time_graph.rb +55 -0
- data/lib/ruby-jmeter/dsl/result_status_action_handler.rb +25 -0
- data/lib/ruby-jmeter/dsl/runtime_controller.rb +25 -0
- data/lib/ruby-jmeter/dsl/save_responses_to_a_file.rb +29 -0
- data/lib/ruby-jmeter/dsl/simple_config_element.rb +23 -0
- data/lib/ruby-jmeter/dsl/simple_controller.rb +23 -0
- data/lib/ruby-jmeter/dsl/simple_data_writer.rb +55 -0
- data/lib/ruby-jmeter/dsl/smime_assertion.rb +35 -0
- data/lib/ruby-jmeter/dsl/smtp_sampler.rb +51 -0
- data/lib/ruby-jmeter/dsl/soapxmlrpc_request.rb +33 -0
- data/lib/ruby-jmeter/dsl/spline_visualizer.rb +55 -0
- data/lib/ruby-jmeter/dsl/summary_report.rb +55 -0
- data/lib/ruby-jmeter/dsl/switch_controller.rb +25 -0
- data/lib/ruby-jmeter/dsl/synchronizing_timer.rb +25 -0
- data/lib/ruby-jmeter/dsl/tcp_sampler.rb +33 -0
- data/lib/ruby-jmeter/dsl/tcp_sampler_config.rb +31 -0
- data/lib/ruby-jmeter/dsl/test_action.rb +27 -0
- data/lib/ruby-jmeter/dsl/test_plan.rb +31 -0
- data/lib/ruby-jmeter/dsl/thread_group.rb +36 -0
- data/lib/ruby-jmeter/dsl/throughput_controller.rb +32 -0
- data/lib/ruby-jmeter/dsl/transaction_controller.rb +26 -0
- data/lib/ruby-jmeter/dsl/uniform_random_timer.rb +26 -0
- data/lib/ruby-jmeter/dsl/user_defined_variables.rb +32 -0
- data/lib/ruby-jmeter/dsl/user_parameters.rb +29 -0
- data/lib/ruby-jmeter/dsl/view_results_in_table.rb +55 -0
- data/lib/ruby-jmeter/dsl/view_results_tree.rb +55 -0
- data/lib/ruby-jmeter/dsl/while_controller.rb +25 -0
- data/lib/ruby-jmeter/dsl/xml_assertion.rb +23 -0
- data/lib/ruby-jmeter/dsl/xml_schema_assertion.rb +25 -0
- data/lib/ruby-jmeter/dsl/xpath_assertion.rb +30 -0
- data/lib/ruby-jmeter/dsl/xpath_extractor.rb +30 -0
- data/lib/ruby-jmeter/helpers/fallback_content_proxy.rb +54 -0
- data/lib/ruby-jmeter/helpers/helper.rb +41 -0
- data/lib/ruby-jmeter/helpers/jmeter.properties +28 -0
- data/lib/ruby-jmeter/helpers/logger-colors.rb +48 -0
- data/lib/ruby-jmeter/helpers/parser.rb +106 -0
- data/lib/ruby-jmeter/helpers/strip-heredoc.rb +5 -0
- data/lib/ruby-jmeter/helpers/user-agents.rb +27 -0
- data/lib/ruby-jmeter/idl.rb +70 -0
- data/lib/ruby-jmeter/idl.xml +1513 -0
- data/lib/ruby-jmeter/plugins/gc_console_status_logger.rb +14 -0
- data/lib/ruby-jmeter/plugins/gc_dummy_sampler.rb +23 -0
- data/lib/ruby-jmeter/plugins/gc_latencies_over_time.rb +48 -0
- data/lib/ruby-jmeter/plugins/gc_response_codes_per_second.rb +48 -0
- data/lib/ruby-jmeter/plugins/gc_response_times_distribution.rb +47 -0
- data/lib/ruby-jmeter/plugins/gc_response_times_over_time.rb +48 -0
- data/lib/ruby-jmeter/plugins/gc_response_times_percentiles.rb +48 -0
- data/lib/ruby-jmeter/plugins/gc_transactions_per_second.rb +48 -0
- data/lib/ruby-jmeter/plugins/gc_variable_throughput_timer.rb +26 -0
- data/lib/ruby-jmeter/version.rb +3 -0
- data/ruby-jmeter.gemspec +22 -0
- data/spec/dsl_spec.rb +491 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/stub.rb +31 -0
- metadata +244 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
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
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
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
|
+
end
|
10
|
+
end
|
11
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
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
|
+
end
|
10
|
+
end
|
11
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
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
|
10
|
+
end
|
11
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
threads count: 100 do
|
6
|
+
visit name: 'Home', url: 'http://altentee.com' do
|
7
|
+
extract regex: "content='(.+?)' name='csrf-token'", name: 'csrf-token'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
threads count: 1 do
|
6
|
+
dummy_sampler '__grid_data_api', {response_data: "ACIR0001, ACIR0002, ACIR0003, ACIR0004, ACIR0005, ACIR0006, ABS0003, MBS0001, MBS0004, MBS0005, ABS0004, ABS0005, ABS0010, ABS0011, ABS0012, ABS0013, ABS0014, ABS0016, ABS0017, ABS0018, ABS0021, ABS0022, MBS0006, MBS0009, MBS0010"}
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
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
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# You need jmeter-plugins at Google code
|
14
|
+
# http://code.google.com/p/jmeter-plugins
|
15
|
+
#
|
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'
|
22
|
+
|
23
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
threads count: 1 do
|
6
|
+
visit name: 'Home Page', url: 'http://google.com/'
|
7
|
+
end
|
8
|
+
end.grid('6CnGKgaTRU62LspdTFbr', {region: 'us-west-2', endpoint: '127.0.0.1:3000'})
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
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
|
12
|
+
|
13
|
+
transaction name: 'Google Search via XHR' do
|
14
|
+
visit name: 'Home Page', url: 'http://google.com/' do
|
15
|
+
with_xhr
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
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
|
+
end
|
15
|
+
view_results name: 'debug'
|
16
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
|
6
|
+
threads count: 1 do
|
7
|
+
|
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}'
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
threads count: 10 do
|
6
|
+
visit name: 'Google Search', url: 'http://google.com/?hl=en&tbo=d&sclient=psy-ab&q=flood.io&oq=flood.io'
|
7
|
+
end
|
8
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
threads count: 100 do
|
6
|
+
|
7
|
+
think_time 5000,5000
|
8
|
+
|
9
|
+
transaction name: 'Google Search' do
|
10
|
+
visit name: 'Home Page', url: 'http://google.com/'
|
11
|
+
random_timer 3000
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
threads count: 100 do
|
6
|
+
|
7
|
+
think_time 5000,5000
|
8
|
+
|
9
|
+
throughput_controller percent: 99 do
|
10
|
+
transaction name: "TC_01", parent: true, include_timers: true
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
threads count: 100 do # threads = RPS * <max response time ms> / 1000
|
6
|
+
|
7
|
+
throughput_shaper 'increasing load test', [
|
8
|
+
{ :start_rps => 100, :end_rps => 100, :duration => 60 },
|
9
|
+
{ :start_rps => 200, :end_rps => 200, :duration => 60 },
|
10
|
+
{ :start_rps => 300, :end_rps => 300, :duration => 60 },
|
11
|
+
{ :start_rps => 400, :end_rps => 400, :duration => 60 },
|
12
|
+
{ :start_rps => 500, :end_rps => 500, :duration => 60 },
|
13
|
+
{ :start_rps => 600, :end_rps => 600, :duration => 60 }
|
14
|
+
]
|
15
|
+
|
16
|
+
transaction name: 'Google Search' do
|
17
|
+
visit name: 'Home Page', url: 'http://google.com/'
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -0,0 +1,64 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'ruby-jmeter'
|
3
|
+
|
4
|
+
test do
|
5
|
+
|
6
|
+
defaults :domain => 'www.etsy.com'
|
7
|
+
|
8
|
+
cache :clear_each_iteration => true
|
9
|
+
|
10
|
+
cookies
|
11
|
+
|
12
|
+
threads :count => 1, :loops => 10 do
|
13
|
+
|
14
|
+
random_timer 1000, 3000
|
15
|
+
|
16
|
+
transaction '01_etsy_home' do
|
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
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Once do
|
23
|
+
transaction '02_etsy_signin' do
|
24
|
+
submit :name => 'signin', :url => 'https://www.etsy.com/signin',
|
25
|
+
:fill_in => {
|
26
|
+
:username => 'tim.koops@gmail.com',
|
27
|
+
:password => ARGV[0],
|
28
|
+
:persistent => 1,
|
29
|
+
:from_page => 'http://www.etsy.com/',
|
30
|
+
:from_action => '',
|
31
|
+
:from_name => '',
|
32
|
+
:overlay => 1
|
33
|
+
} do
|
34
|
+
assert 'contains' => 'Tim'
|
35
|
+
extract :regex => 'a href="(/browse.+?)"', :name => 'random_category'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
exists 'random_category' do
|
41
|
+
|
42
|
+
transaction '03_etsy_browse_random_category' do
|
43
|
+
visit :name => 'browse', :url => '${random_category}' do
|
44
|
+
extract :regex => 'a href="(http.+?subcat.+?)"', :name => 'random_sub_category'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
transaction '04_etsy_browse_random_sub_category' do
|
49
|
+
visit :name => 'browse', :url => '${random_sub_category}' do
|
50
|
+
extract :regex => 'a href="(/listing.+?)"', :name => 'random_listing'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
transaction '05_etsy_view_random_listing' do
|
55
|
+
visit :name => 'view', :url => '${random_listing}'
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
# end.grid ARGV[1]
|
63
|
+
# end.jmx
|
64
|
+
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
data/lib/ruby-jmeter.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'rest_client'
|
3
|
+
require 'json'
|
4
|
+
require 'cgi'
|
5
|
+
require 'open3'
|
6
|
+
|
7
|
+
require 'ruby-jmeter/version'
|
8
|
+
require 'ruby-jmeter/helpers/helper'
|
9
|
+
require 'ruby-jmeter/helpers/parser'
|
10
|
+
require 'ruby-jmeter/helpers/fallback_content_proxy'
|
11
|
+
require 'ruby-jmeter/helpers/logger-colors'
|
12
|
+
require 'ruby-jmeter/helpers/strip-heredoc'
|
13
|
+
require 'ruby-jmeter/helpers/user-agents'
|
14
|
+
|
15
|
+
lib = File.dirname(File.absolute_path(__FILE__))
|
16
|
+
Dir.glob(lib + '/ruby-jmeter/dsl/*', &method(:require))
|
17
|
+
Dir.glob(lib + '/ruby-jmeter/plugins/*', &method(:require))
|
18
|
+
require 'ruby-jmeter/dsl'
|
@@ -0,0 +1,237 @@
|
|
1
|
+
# RubyJmeter::DSL methods
|
2
|
+
- Test Plan
|
3
|
+
`test_plan`
|
4
|
+
- Counter
|
5
|
+
`counter`
|
6
|
+
- CSV Data Set Config
|
7
|
+
`csv_data_set_config`
|
8
|
+
- FTP Request Defaults
|
9
|
+
`ftp_request_defaults`
|
10
|
+
- HTTP Authorization Manager
|
11
|
+
`http_authorization_manager`
|
12
|
+
- HTTP Cache Manager
|
13
|
+
`http_cache_manager`
|
14
|
+
- HTTP Cookie Manager
|
15
|
+
`http_cookie_manager`
|
16
|
+
- HTTP Header Manager
|
17
|
+
`http_header_manager`
|
18
|
+
- HTTP Request Defaults
|
19
|
+
`http_request_defaults`
|
20
|
+
- Java Request Defaults
|
21
|
+
`java_request_defaults`
|
22
|
+
- JDBC Connection Configuration
|
23
|
+
`jdbc_connection_configuration`
|
24
|
+
- Keystore Configuration
|
25
|
+
`keystore_configuration`
|
26
|
+
- LDAP Extended Request Defaults
|
27
|
+
`ldap_extended_request_defaults`
|
28
|
+
- LDAP Request Defaults
|
29
|
+
`ldap_request_defaults`
|
30
|
+
- Login Config Element
|
31
|
+
`login_config_element`
|
32
|
+
- Random Variable
|
33
|
+
`random_variable`
|
34
|
+
- Simple Config Element
|
35
|
+
`simple_config_element`
|
36
|
+
- TCP Sampler Config
|
37
|
+
`tcp_sampler_config`
|
38
|
+
- User Defined Variables
|
39
|
+
`user_defined_variables`
|
40
|
+
- Thread Group
|
41
|
+
`thread_group`
|
42
|
+
- ForEach Controller
|
43
|
+
`foreach_controller`
|
44
|
+
- If Controller
|
45
|
+
`if_controller`
|
46
|
+
- Include Controller
|
47
|
+
`include_controller`
|
48
|
+
- Loop Controller
|
49
|
+
`loop_controller`
|
50
|
+
- Module Controller
|
51
|
+
`module_controller`
|
52
|
+
- Once Only Controller
|
53
|
+
`once_only_controller`
|
54
|
+
- Random Controller
|
55
|
+
`random_controller`
|
56
|
+
- Random Order Controller
|
57
|
+
`random_order_controller`
|
58
|
+
- Recording Controller
|
59
|
+
`recording_controller`
|
60
|
+
- Runtime Controller
|
61
|
+
`runtime_controller`
|
62
|
+
- Simple Controller
|
63
|
+
`simple_controller`
|
64
|
+
- Switch Controller
|
65
|
+
`switch_controller`
|
66
|
+
- Throughput Controller
|
67
|
+
`throughput_controller`
|
68
|
+
- Transaction Controller
|
69
|
+
`transaction_controller`
|
70
|
+
- While Controller
|
71
|
+
`while_controller`
|
72
|
+
- BeanShell Timer
|
73
|
+
`beanshell_timer`
|
74
|
+
- BSF Timer
|
75
|
+
`bsf_timer`
|
76
|
+
- Constant Throughput Timer
|
77
|
+
`constant_throughput_timer`
|
78
|
+
- Constant Timer
|
79
|
+
`constant_timer`
|
80
|
+
- Gaussian Random Timer
|
81
|
+
`gaussian_random_timer`
|
82
|
+
- JSR223 Timer
|
83
|
+
`jsr223_timer`
|
84
|
+
- Poisson Random Timer
|
85
|
+
`poisson_random_timer`
|
86
|
+
- Synchronizing Timer
|
87
|
+
`synchronizing_timer`
|
88
|
+
- Uniform Random Timer
|
89
|
+
`uniform_random_timer`
|
90
|
+
- BeanShell PreProcessor
|
91
|
+
`beanshell_preprocessor`
|
92
|
+
- BSF PreProcessor
|
93
|
+
`bsf_preprocessor`
|
94
|
+
- HTML Link Parser
|
95
|
+
`html_link_parser`
|
96
|
+
- HTML Parameter Mask
|
97
|
+
`html_parameter_mask`
|
98
|
+
- HTTP URL Re-writing Modifier
|
99
|
+
`http_url_rewriting_modifier`
|
100
|
+
- JDBC PreProcessor
|
101
|
+
`jdbc_preprocessor`
|
102
|
+
- JSR223 PreProcessor
|
103
|
+
`jsr223_preprocessor`
|
104
|
+
- RegEx User Parameters
|
105
|
+
`regex_user_parameters`
|
106
|
+
- User Parameters
|
107
|
+
`user_parameters`
|
108
|
+
- Access Log Sampler
|
109
|
+
`access_log_sampler`
|
110
|
+
- AJP/1.3 Sampler
|
111
|
+
`ajp13_sampler`
|
112
|
+
- BeanShell Sampler
|
113
|
+
`beanshell_sampler`
|
114
|
+
- BSF Sampler
|
115
|
+
`bsf_sampler`
|
116
|
+
- Debug Sampler
|
117
|
+
`debug_sampler`
|
118
|
+
- FTP Request
|
119
|
+
`ftp_request`
|
120
|
+
- HTTP Request
|
121
|
+
`http_request`
|
122
|
+
- Java Request
|
123
|
+
`java_request`
|
124
|
+
- JDBC Request
|
125
|
+
`jdbc_request`
|
126
|
+
- JMS Point-to-Point
|
127
|
+
`jms_pointtopoint`
|
128
|
+
- JMS Publisher
|
129
|
+
`jms_publisher`
|
130
|
+
- JMS Subscriber
|
131
|
+
`jms_subscriber`
|
132
|
+
- JSR223 Sampler
|
133
|
+
`jsr223_sampler`
|
134
|
+
- JUnit Request
|
135
|
+
`junit_request`
|
136
|
+
- LDAP Extended Request
|
137
|
+
`ldap_extended_request`
|
138
|
+
- LDAP Request
|
139
|
+
`ldap_request`
|
140
|
+
- Mail Reader Sampler
|
141
|
+
`mail_reader_sampler`
|
142
|
+
- OS Process Sampler
|
143
|
+
`os_process_sampler`
|
144
|
+
- SMTP Sampler
|
145
|
+
`smtp_sampler`
|
146
|
+
- SOAP/XML-RPC Request
|
147
|
+
`soapxmlrpc_request`
|
148
|
+
- TCP Sampler
|
149
|
+
`tcp_sampler`
|
150
|
+
- Test Action
|
151
|
+
`test_action`
|
152
|
+
- BeanShell PostProcessor
|
153
|
+
`beanshell_postprocessor`
|
154
|
+
- BSF PostProcessor
|
155
|
+
`bsf_postprocessor`
|
156
|
+
- CSS/JQuery Extractor
|
157
|
+
`cssjquery_extractor`
|
158
|
+
- Debug PostProcessor
|
159
|
+
`debug_postprocessor`
|
160
|
+
- JDBC PostProcessor
|
161
|
+
`jdbc_postprocessor`
|
162
|
+
- JSR223 PostProcessor
|
163
|
+
`jsr223_postprocessor`
|
164
|
+
- Regular Expression Extractor
|
165
|
+
`regular_expression_extractor`
|
166
|
+
- Result Status Action Handler
|
167
|
+
`result_status_action_handler`
|
168
|
+
- XPath Extractor
|
169
|
+
`xpath_extractor`
|
170
|
+
- BeanShell Assertion
|
171
|
+
`beanshell_assertion`
|
172
|
+
- BSF Assertion
|
173
|
+
`bsf_assertion`
|
174
|
+
- Compare Assertion
|
175
|
+
`compare_assertion`
|
176
|
+
- Duration Assertion
|
177
|
+
`duration_assertion`
|
178
|
+
- HTML Assertion
|
179
|
+
`html_assertion`
|
180
|
+
- JSR223 Assertion
|
181
|
+
`jsr223_assertion`
|
182
|
+
- JSR223 Assertion
|
183
|
+
`jsr223_assertion`
|
184
|
+
- MD5Hex Assertion
|
185
|
+
`md5hex_assertion`
|
186
|
+
- MD5Hex Assertion
|
187
|
+
`md5hex_assertion`
|
188
|
+
- Response Assertion
|
189
|
+
`response_assertion`
|
190
|
+
- SMIME Assertion
|
191
|
+
`smime_assertion`
|
192
|
+
- XML Assertion
|
193
|
+
`xml_assertion`
|
194
|
+
- XML Schema Assertion
|
195
|
+
`xml_schema_assertion`
|
196
|
+
- XPath Assertion
|
197
|
+
`xpath_assertion`
|
198
|
+
- Aggregate Graph
|
199
|
+
`aggregate_graph`
|
200
|
+
- Aggregate Report
|
201
|
+
`aggregate_report`
|
202
|
+
- Assertion Results
|
203
|
+
`assertion_results`
|
204
|
+
- BeanShell Listener
|
205
|
+
`beanshell_listener`
|
206
|
+
- BSF Listener
|
207
|
+
`bsf_listener`
|
208
|
+
- Comparison Assertion Visualizer
|
209
|
+
`comparison_assertion_visualizer`
|
210
|
+
- Distribution Graph (alpha)
|
211
|
+
`distribution_graphalpha`
|
212
|
+
- Generate Summary Results
|
213
|
+
`generate_summary_results`
|
214
|
+
- Graph Results
|
215
|
+
`graph_results`
|
216
|
+
- JSR223 Listener
|
217
|
+
`jsr223_listener`
|
218
|
+
- Mailer Visualizer
|
219
|
+
`mailer_visualizer`
|
220
|
+
- Monitor Results
|
221
|
+
`monitor_results`
|
222
|
+
- Response Time Graph
|
223
|
+
`response_time_graph`
|
224
|
+
- Response Time Graph
|
225
|
+
`response_time_graph`
|
226
|
+
- Save Responses to a file
|
227
|
+
`save_responses_to_a_file`
|
228
|
+
- Simple Data Writer
|
229
|
+
`simple_data_writer`
|
230
|
+
- Spline Visualizer
|
231
|
+
`spline_visualizer`
|
232
|
+
- Summary Report
|
233
|
+
`summary_report`
|
234
|
+
- View Results in Table
|
235
|
+
`view_results_in_table`
|
236
|
+
- View Results Tree
|
237
|
+
`view_results_tree`
|