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.
- data/Gemfile +2 -1
- data/README.md +51 -72
- data/examples/basic_assertion.rb +6 -6
- data/examples/basic_auth.rb +5 -5
- data/examples/basic_cache.rb +5 -5
- data/examples/basic_cookies.rb +5 -5
- data/examples/basic_extract.rb +4 -10
- data/examples/basic_gc_results.rb +12 -9
- data/examples/basic_google.rb +3 -3
- data/examples/basic_grid.rb +3 -6
- data/examples/basic_header.rb +12 -10
- data/examples/basic_ldap_ext.rb +11 -12
- data/examples/basic_post.rb +5 -6
- data/examples/basic_query_params.rb +3 -3
- data/examples/basic_think_time.rb +7 -4
- data/examples/basic_throughput_shaping_timer.rb +4 -4
- data/examples/etsy_login_browse.rb +21 -21
- data/lib/gridinit-jmeter/DSL.md +237 -0
- data/lib/gridinit-jmeter/{idl → dsl}/access_log_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/aggregate_graph.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/aggregate_report.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ajp13_sampler.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/assertion_results.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_listener.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_preprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/beanshell_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_listener.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_preprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/bsf_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/compare_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/comparison_assertion_visualizer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/constant_throughput_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/constant_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/counter.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/cssjquery_extractor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/csv_data_set_config.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/debug_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/debug_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/distribution_graphalpha.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/duration_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/foreach_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ftp_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ftp_request_defaults.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/gaussian_random_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/generate_summary_results.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/graph_results.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/html_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/html_link_parser.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/html_parameter_mask.rb +4 -2
- data/lib/gridinit-jmeter/dsl/http_authorization_manager.rb +36 -0
- data/lib/gridinit-jmeter/{idl → dsl}/http_cache_manager.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/http_cookie_manager.rb +5 -2
- data/lib/gridinit-jmeter/{idl → dsl}/http_header_manager.rb +10 -3
- data/lib/gridinit-jmeter/{idl → dsl}/http_request.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/http_request_defaults.rb +15 -4
- data/lib/gridinit-jmeter/{idl → dsl}/http_url_rewriting_modifier.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/if_controller.rb +5 -2
- data/lib/gridinit-jmeter/{idl → dsl}/include_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/java_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/java_request_defaults.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jdbc_connection_configuration.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jdbc_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jdbc_preprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jdbc_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jms_pointtopoint.rb +6 -4
- data/lib/gridinit-jmeter/{idl → dsl}/jms_publisher.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/jms_subscriber.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_listener.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_postprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_preprocessor.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/jsr223_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/junit_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/keystore_configuration.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ldap_extended_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ldap_extended_request_defaults.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/ldap_request.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/ldap_request_defaults.rb +13 -4
- data/lib/gridinit-jmeter/{idl → dsl}/login_config_element.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/loop_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/mail_reader_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/mailer_visualizer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/md5hex_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/module_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/monitor_results.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/once_only_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/os_process_sampler.rb +6 -4
- data/lib/gridinit-jmeter/{idl → dsl}/poisson_random_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/random_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/random_order_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/random_variable.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/recording_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/regex_user_parameters.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/regular_expression_extractor.rb +5 -2
- data/lib/gridinit-jmeter/{idl → dsl}/response_assertion.rb +8 -3
- data/lib/gridinit-jmeter/{idl → dsl}/response_time_graph.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/result_status_action_handler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/runtime_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/save_responses_to_a_file.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/simple_config_element.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/simple_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/simple_data_writer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/smime_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/smtp_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/soapxmlrpc_request.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/spline_visualizer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/summary_report.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/switch_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/synchronizing_timer.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/tcp_sampler.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/tcp_sampler_config.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/test_action.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/test_plan.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/thread_group.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/throughput_controller.rb +5 -3
- data/lib/gridinit-jmeter/{idl → dsl}/transaction_controller.rb +6 -3
- data/lib/gridinit-jmeter/{idl → dsl}/uniform_random_timer.rb +4 -2
- data/lib/gridinit-jmeter/dsl/user_defined_variables.rb +35 -0
- data/lib/gridinit-jmeter/{idl → dsl}/user_parameters.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/view_results_in_table.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/view_results_tree.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/while_controller.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/xml_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/xml_schema_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/xpath_assertion.rb +4 -2
- data/lib/gridinit-jmeter/{idl → dsl}/xpath_extractor.rb +4 -2
- data/lib/gridinit-jmeter/dsl.rb +170 -187
- data/lib/gridinit-jmeter/helpers/helper.rb +43 -0
- data/lib/gridinit-jmeter/helpers/parser.rb +109 -0
- data/lib/gridinit-jmeter/idl.rb +16 -6
- data/lib/gridinit-jmeter/idl.xml +54 -11
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_console_status_logger.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_latencies_over_time.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_codes_per_second.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_distribution.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_over_time.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_response_times_percentiles.rb +0 -0
- data/lib/gridinit-jmeter/{listeners → plugins}/gc_transactions_per_second.rb +0 -0
- data/lib/gridinit-jmeter/{timers/gc_throughput_shaping_timer.rb → plugins/gc_variable_throughput_timer.rb} +1 -1
- data/lib/gridinit-jmeter/version.rb +1 -1
- data/lib/gridinit-jmeter.rb +6 -105
- data/spec/dsl_spec.rb +377 -82
- metadata +131 -174
- data/examples/basic_proxy.rb +0 -8
- data/examples/basic_results.rb +0 -22
- data/examples/basic_run.rb +0 -12
- data/examples/basic_simple_data_writer.rb +0 -14
- data/examples/basic_stdout.rb +0 -8
- data/examples/basic_test_data.rb +0 -15
- data/examples/basic_testplan.jmx +0 -138
- data/examples/basic_testplan.rb +0 -44
- data/examples/jbhifi_now_search.rb +0 -94
- data/lib/gridinit-jmeter/assertions/response_assertion.rb +0 -55
- data/lib/gridinit-jmeter/config/auth_manager.rb +0 -26
- data/lib/gridinit-jmeter/config/cache_manager.rb +0 -20
- data/lib/gridinit-jmeter/config/cookie_manager.rb +0 -21
- data/lib/gridinit-jmeter/config/counter_config.rb +0 -24
- data/lib/gridinit-jmeter/config/header_manager.rb +0 -26
- data/lib/gridinit-jmeter/config/random_variable.rb +0 -24
- data/lib/gridinit-jmeter/config/request_defaults.rb +0 -31
- data/lib/gridinit-jmeter/config/user_defined_variable.rb +0 -25
- data/lib/gridinit-jmeter/controllers/if_controller.rb +0 -20
- data/lib/gridinit-jmeter/controllers/interleave.rb +0 -18
- data/lib/gridinit-jmeter/controllers/loop_controller.rb +0 -19
- data/lib/gridinit-jmeter/controllers/once_only.rb +0 -17
- data/lib/gridinit-jmeter/controllers/random_order.rb +0 -16
- data/lib/gridinit-jmeter/controllers/simple.rb +0 -17
- data/lib/gridinit-jmeter/controllers/switch.rb +0 -20
- data/lib/gridinit-jmeter/controllers/throughput.rb +0 -26
- data/lib/gridinit-jmeter/controllers/transaction.rb +0 -19
- data/lib/gridinit-jmeter/controllers/while_controller.rb +0 -18
- data/lib/gridinit-jmeter/helpers/dsl_helper.rb +0 -21
- data/lib/gridinit-jmeter/idl/http_authorization_manager.rb +0 -26
- data/lib/gridinit-jmeter/idl/user_defined_variables.rb +0 -26
- data/lib/gridinit-jmeter/listeners/aggregate_report.rb +0 -47
- data/lib/gridinit-jmeter/listeners/graph_visualizer.rb +0 -46
- data/lib/gridinit-jmeter/listeners/response_time_graph_visualizer.rb +0 -47
- data/lib/gridinit-jmeter/listeners/simple_data_writer.rb +0 -51
- data/lib/gridinit-jmeter/listeners/stat_visualizer.rb +0 -46
- data/lib/gridinit-jmeter/listeners/summary_report.rb +0 -46
- data/lib/gridinit-jmeter/listeners/table_visualizer.rb +0 -46
- data/lib/gridinit-jmeter/listeners/view_results_full_visualizer.rb +0 -57
- data/lib/gridinit-jmeter/post_processors/regex_extractor.rb +0 -34
- data/lib/gridinit-jmeter/post_processors/xpath_extractor.rb +0 -23
- data/lib/gridinit-jmeter/pre_processors/bean_shell_pre_processor.rb +0 -23
- data/lib/gridinit-jmeter/samplers/http_sampler.rb +0 -99
- data/lib/gridinit-jmeter/samplers/ldap_ext_sampler.rb +0 -36
- data/lib/gridinit-jmeter/samplers/soap_sampler.rb +0 -26
- data/lib/gridinit-jmeter/test_plan/test_plan.rb +0 -23
- data/lib/gridinit-jmeter/threads/thread_group.rb +0 -30
- data/lib/gridinit-jmeter/timers/gaussian_random_timer.rb +0 -18
@@ -0,0 +1,43 @@
|
|
1
|
+
module Gridinit
|
2
|
+
|
3
|
+
def dsl_eval(dsl, &block)
|
4
|
+
block_context = eval("self", block.binding)
|
5
|
+
proxy_context = Gridinit::Jmeter::FallbackContextProxy.new(dsl, block_context)
|
6
|
+
begin
|
7
|
+
block_context.instance_variables.each { |ivar| proxy_context.instance_variable_set(ivar, block_context.instance_variable_get(ivar)) }
|
8
|
+
proxy_context.instance_eval(&block)
|
9
|
+
ensure
|
10
|
+
block_context.instance_variables.each { |ivar| block_context.instance_variable_set(ivar, proxy_context.instance_variable_get(ivar)) }
|
11
|
+
end
|
12
|
+
dsl
|
13
|
+
end
|
14
|
+
|
15
|
+
module_function :dsl_eval
|
16
|
+
|
17
|
+
module Jmeter
|
18
|
+
module Helper
|
19
|
+
def update(params)
|
20
|
+
params.delete(:name)
|
21
|
+
params.each do |name, value|
|
22
|
+
node = @doc.children.xpath("//*[contains(@name,\"#{name.to_s}\")]")
|
23
|
+
node.first.content = value unless node.empty?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def update_at_xpath(params)
|
28
|
+
params[:update_at_xpath].each do |fragment|
|
29
|
+
@doc.at_xpath(fragment[:xpath]) << fragment[:value]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def enabled(params)
|
34
|
+
#default to true unless explicitly set to false
|
35
|
+
if params.has_key?(:enabled) && params[:enabled] == false
|
36
|
+
'false'
|
37
|
+
else
|
38
|
+
'true'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module Gridinit
|
2
|
+
|
3
|
+
module Jmeter
|
4
|
+
module Parser
|
5
|
+
|
6
|
+
def parse_http_request(params)
|
7
|
+
parse_url(params) unless params[:url].empty?
|
8
|
+
|
9
|
+
if params[:raw_path]
|
10
|
+
params[:path] = params[:url]
|
11
|
+
else
|
12
|
+
params[:fill_in] ||= {}
|
13
|
+
params[:params] && params[:params].split('&').each do |param|
|
14
|
+
name,value = param.split('=')
|
15
|
+
params[:fill_in][name] = value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
fill_in(params) if params.has_key?(:fill_in)
|
20
|
+
raw_body(params) if params.has_key?(:raw_body)
|
21
|
+
end
|
22
|
+
|
23
|
+
def parse_url(params)
|
24
|
+
if params[:url] =~ /https?:\/\/\$/ || params[:url][0] == '$'
|
25
|
+
params[:path] = params[:url] # special case for named expressions
|
26
|
+
else
|
27
|
+
uri = parse_uri(params[:url])
|
28
|
+
params[:port] ||= uri.port unless URI.parse(URI::encode(params[:url])).scheme.nil?
|
29
|
+
params[:protocol] ||= uri.scheme unless URI.parse(URI::encode(params[:url])).scheme.nil?
|
30
|
+
params[:domain] ||= uri.host
|
31
|
+
params[:path] ||= uri.path && URI::decode(uri.path)
|
32
|
+
params[:params] ||= uri.query && URI::decode(uri.query)
|
33
|
+
end
|
34
|
+
params.delete(:url)
|
35
|
+
end
|
36
|
+
|
37
|
+
def parse_uri(uri)
|
38
|
+
URI.parse(URI::encode(uri)).scheme.nil? ?
|
39
|
+
URI.parse(URI::encode("http://#{uri}")) :
|
40
|
+
URI.parse(URI::encode(uri))
|
41
|
+
end
|
42
|
+
|
43
|
+
def fill_in(params)
|
44
|
+
params[:update_at_xpath] ||= []
|
45
|
+
params[:update_at_xpath] += params[:fill_in].collect do |name, value|
|
46
|
+
{
|
47
|
+
:xpath => '//collectionProp',
|
48
|
+
:value => Nokogiri::XML(<<-EOF.strip_heredoc).children
|
49
|
+
<elementProp name="#{name}" elementType="HTTPArgument">
|
50
|
+
<boolProp name="HTTPArgument.always_encode">#{params[:always_encode] ? 'true' : false}</boolProp>
|
51
|
+
<stringProp name="Argument.value">#{value}</stringProp>
|
52
|
+
<stringProp name="Argument.metadata">=</stringProp>
|
53
|
+
<boolProp name="HTTPArgument.use_equals">true</boolProp>
|
54
|
+
<stringProp name="Argument.name">#{name}</stringProp>
|
55
|
+
</elementProp>
|
56
|
+
EOF
|
57
|
+
}
|
58
|
+
end
|
59
|
+
params.delete(:fill_in)
|
60
|
+
end
|
61
|
+
|
62
|
+
def raw_body(params)
|
63
|
+
params[:update_at_xpath] ||= []
|
64
|
+
params[:update_at_xpath] << {
|
65
|
+
:xpath => '//HTTPSamplerProxy',
|
66
|
+
:value => Nokogiri::XML(<<-EOF.strip_heredoc).children
|
67
|
+
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
|
68
|
+
EOF
|
69
|
+
}
|
70
|
+
|
71
|
+
params[:update_at_xpath] << {
|
72
|
+
:xpath => '//collectionProp',
|
73
|
+
:value => Nokogiri::XML(<<-EOF.strip_heredoc).children
|
74
|
+
<elementProp name="" elementType="HTTPArgument">
|
75
|
+
<boolProp name="HTTPArgument.always_encode">false</boolProp>
|
76
|
+
<stringProp name="Argument.value">#{params[:raw_body]}</stringProp>
|
77
|
+
<stringProp name="Argument.metadata">=</stringProp>
|
78
|
+
</elementProp>
|
79
|
+
EOF
|
80
|
+
}
|
81
|
+
params.delete(:raw_body)
|
82
|
+
end
|
83
|
+
|
84
|
+
def parse_test_type(params)
|
85
|
+
case params.keys.first
|
86
|
+
when 'contains'
|
87
|
+
2
|
88
|
+
when 'not-contains'
|
89
|
+
6
|
90
|
+
when 'matches'
|
91
|
+
1
|
92
|
+
when 'not-matches'
|
93
|
+
5
|
94
|
+
when 'equals'
|
95
|
+
8
|
96
|
+
when 'not-equals'
|
97
|
+
12
|
98
|
+
when 'substring'
|
99
|
+
16
|
100
|
+
when 'not-substring'
|
101
|
+
20
|
102
|
+
else
|
103
|
+
2
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
data/lib/gridinit-jmeter/idl.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# This is an IDL script to translate a JMeter testplan into Ruby DSL objects
|
2
3
|
require 'nokogiri'
|
3
|
-
|
4
|
+
require 'pathname'
|
4
5
|
|
5
|
-
|
6
|
+
home = Pathname("..").expand_path(__FILE__)
|
7
|
+
dsl = File.join(home, "/dsl")
|
8
|
+
|
9
|
+
file = File.open File.join(home, "idl.xml")
|
6
10
|
doc = Nokogiri::XML file.read.gsub! /\n\s+/, ''
|
7
11
|
nodes = doc.xpath '//jmeterTestPlan/hashTree'
|
8
12
|
|
@@ -29,10 +33,13 @@ doc.traverse do |node|
|
|
29
33
|
node.name != 'elementProp'
|
30
34
|
end
|
31
35
|
|
36
|
+
methods = []
|
37
|
+
methods << "# Gridinit::JMeter::DSL methods"
|
32
38
|
results.each do |element|
|
33
39
|
klass = element.attributes['testname'].to_s.classify
|
34
|
-
|
35
|
-
|
40
|
+
methods << "- #{element.attributes['testname'].to_s}\n `#{klass.underscore}`"
|
41
|
+
Dir.mkdir(dsl, 0700) unless Dir.exist? dsl
|
42
|
+
File.open("#{dsl}/#{klass.underscore}.rb", 'w') { |file| file.write(<<EOC)
|
36
43
|
module Gridinit
|
37
44
|
module Jmeter
|
38
45
|
|
@@ -47,11 +54,13 @@ module Gridinit
|
|
47
54
|
attr_accessor :doc
|
48
55
|
include Helper
|
49
56
|
|
50
|
-
def initialize(
|
57
|
+
def initialize(params={})
|
58
|
+
params[:name] ||= '#{klass}'
|
51
59
|
@doc = Nokogiri::XML(<<-EOS.strip_heredoc)
|
52
|
-
#{element.to_xml.gsub /testname=".+?"/, 'testname="#{name}"'})
|
60
|
+
#{element.to_xml.gsub /testname=".+?"/, 'testname="#{params[:name]}"'})
|
53
61
|
EOS
|
54
62
|
update params
|
63
|
+
update_at_xpath params if params[:update_at_xpath]
|
55
64
|
end
|
56
65
|
end
|
57
66
|
|
@@ -61,3 +70,4 @@ EOC
|
|
61
70
|
}
|
62
71
|
end
|
63
72
|
|
73
|
+
File.open("#{home}/DSL.md", 'w') { |file| file.write methods.join("\n") }
|
data/lib/gridinit-jmeter/idl.xml
CHANGED
@@ -43,7 +43,15 @@
|
|
43
43
|
</ConfigTestElement>
|
44
44
|
<hashTree/>
|
45
45
|
<AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
|
46
|
-
<collectionProp name="AuthManager.auth_list"
|
46
|
+
<collectionProp name="AuthManager.auth_list">
|
47
|
+
<elementProp name="" elementType="Authorization">
|
48
|
+
<stringProp name="Authorization.url"></stringProp>
|
49
|
+
<stringProp name="Authorization.username"></stringProp>
|
50
|
+
<stringProp name="Authorization.password"></stringProp>
|
51
|
+
<stringProp name="Authorization.domain"></stringProp>
|
52
|
+
<stringProp name="Authorization.realm"></stringProp>
|
53
|
+
</elementProp>
|
54
|
+
</collectionProp>
|
47
55
|
</AuthManager>
|
48
56
|
<hashTree/>
|
49
57
|
<CacheManager guiclass="CacheManagerGui" testclass="CacheManager" testname="HTTP Cache Manager" enabled="true">
|
@@ -54,10 +62,16 @@
|
|
54
62
|
<CookieManager guiclass="CookiePanel" testclass="CookieManager" testname="HTTP Cookie Manager" enabled="true">
|
55
63
|
<collectionProp name="CookieManager.cookies"/>
|
56
64
|
<boolProp name="CookieManager.clearEachIteration">false</boolProp>
|
65
|
+
<stringProp name="CookieManager.policy">default</stringProp>
|
57
66
|
</CookieManager>
|
58
67
|
<hashTree/>
|
59
68
|
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
|
60
|
-
<collectionProp name="HeaderManager.headers"
|
69
|
+
<collectionProp name="HeaderManager.headers">
|
70
|
+
<elementProp name="" elementType="Header">
|
71
|
+
<stringProp name="Header.name"></stringProp>
|
72
|
+
<stringProp name="Header.value"></stringProp>
|
73
|
+
</elementProp>
|
74
|
+
</collectionProp>
|
61
75
|
</HeaderManager>
|
62
76
|
<hashTree/>
|
63
77
|
<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
|
@@ -70,7 +84,16 @@
|
|
70
84
|
<stringProp name="HTTPSampler.response_timeout"></stringProp>
|
71
85
|
<stringProp name="HTTPSampler.protocol"></stringProp>
|
72
86
|
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
|
73
|
-
<stringProp name="HTTPSampler.path"
|
87
|
+
<stringProp name="HTTPSampler.path">/</stringProp>
|
88
|
+
<stringProp name="HTTPSampler.method">GET</stringProp>
|
89
|
+
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
|
90
|
+
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
|
91
|
+
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
|
92
|
+
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
|
93
|
+
<boolProp name="HTTPSampler.monitor">false</boolProp>
|
94
|
+
<boolProp name="HTTPSampler.image_parser">false</boolProp>
|
95
|
+
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
|
96
|
+
<boolProp name="HTTPSampler.concurrentDwn">false</boolProp>
|
74
97
|
<stringProp name="HTTPSampler.concurrentPool">4</stringProp>
|
75
98
|
</ConfigTestElement>
|
76
99
|
<hashTree/>
|
@@ -173,7 +196,14 @@
|
|
173
196
|
<stringProp name="test">add</stringProp>
|
174
197
|
<stringProp name="base_entry_dn"></stringProp>
|
175
198
|
<elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
176
|
-
<collectionProp name="Arguments.arguments"
|
199
|
+
<collectionProp name="Arguments.arguments">
|
200
|
+
<elementProp name="testguid" elementType="Argument">
|
201
|
+
<stringProp name="Argument.name"></stringProp>
|
202
|
+
<stringProp name="Argument.value"></stringProp>
|
203
|
+
<stringProp name="Argument.metadata">=</stringProp>
|
204
|
+
</elementProp>
|
205
|
+
</collectionProp>
|
206
|
+
<stringProp name="TestPlan.comments"></stringProp>
|
177
207
|
</elementProp>
|
178
208
|
</ConfigTestElement>
|
179
209
|
<hashTree/>
|
@@ -204,7 +234,14 @@
|
|
204
234
|
</ConfigTestElement>
|
205
235
|
<hashTree/>
|
206
236
|
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
|
207
|
-
<collectionProp name="Arguments.arguments"
|
237
|
+
<collectionProp name="Arguments.arguments">
|
238
|
+
<elementProp name="testguid" elementType="Argument">
|
239
|
+
<stringProp name="Argument.name"></stringProp>
|
240
|
+
<stringProp name="Argument.value"></stringProp>
|
241
|
+
<stringProp name="Argument.metadata">=</stringProp>
|
242
|
+
</elementProp>
|
243
|
+
</collectionProp>
|
244
|
+
<stringProp name="TestPlan.comments"></stringProp>
|
208
245
|
</Arguments>
|
209
246
|
<hashTree/>
|
210
247
|
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
|
@@ -231,6 +268,7 @@
|
|
231
268
|
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="If Controller" enabled="true">
|
232
269
|
<stringProp name="IfController.condition"></stringProp>
|
233
270
|
<boolProp name="IfController.evaluateAll">false</boolProp>
|
271
|
+
<boolProp name="IfController.useExpression">false</boolProp>
|
234
272
|
</IfController>
|
235
273
|
<hashTree/>
|
236
274
|
<IncludeController guiclass="IncludeControllerGui" testclass="IncludeController" testname="Include Controller" enabled="true">
|
@@ -266,7 +304,7 @@
|
|
266
304
|
<hashTree/>
|
267
305
|
<ThroughputController guiclass="ThroughputControllerGui" testclass="ThroughputController" testname="Throughput Controller" enabled="true">
|
268
306
|
<intProp name="ThroughputController.style">0</intProp>
|
269
|
-
<boolProp name="ThroughputController.perThread">
|
307
|
+
<boolProp name="ThroughputController.perThread">false</boolProp>
|
270
308
|
<intProp name="ThroughputController.maxThroughput">1</intProp>
|
271
309
|
<FloatProperty>
|
272
310
|
<name>ThroughputController.percentThroughput</name>
|
@@ -276,7 +314,8 @@
|
|
276
314
|
</ThroughputController>
|
277
315
|
<hashTree/>
|
278
316
|
<TransactionController guiclass="TransactionControllerGui" testclass="TransactionController" testname="Transaction Controller" enabled="true">
|
279
|
-
<boolProp name="TransactionController.parent">
|
317
|
+
<boolProp name="TransactionController.parent">true</boolProp>
|
318
|
+
<boolProp name="TransactionController.includeTimers">false</boolProp>
|
280
319
|
</TransactionController>
|
281
320
|
<hashTree/>
|
282
321
|
<WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="While Controller" enabled="true">
|
@@ -802,6 +841,7 @@
|
|
802
841
|
<stringProp name="RegexExtractor.template"></stringProp>
|
803
842
|
<stringProp name="RegexExtractor.default"></stringProp>
|
804
843
|
<stringProp name="RegexExtractor.match_number"></stringProp>
|
844
|
+
<stringProp name="Sample.scope">all</stringProp>
|
805
845
|
</RegexExtractor>
|
806
846
|
<hashTree/>
|
807
847
|
<ResultAction guiclass="ResultActionGui" testclass="ResultAction" testname="Result Status Action Handler" enabled="true">
|
@@ -875,10 +915,13 @@
|
|
875
915
|
</MD5HexAssertion>
|
876
916
|
<hashTree/>
|
877
917
|
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
|
878
|
-
<collectionProp name="Asserion.test_strings"
|
879
|
-
|
880
|
-
|
881
|
-
|
918
|
+
<collectionProp name="Asserion.test_strings">
|
919
|
+
<stringProp name="match"></stringProp>
|
920
|
+
</collectionProp>
|
921
|
+
<stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
|
922
|
+
<boolProp name="Assertion.assume_success">false</boolProp>
|
923
|
+
<intProp name="Assertion.test_type">2</intProp>
|
924
|
+
<stringProp name="Assertion.scope">all</stringProp>
|
882
925
|
</ResponseAssertion>
|
883
926
|
<hashTree/>
|
884
927
|
<SMIMEAssertion guiclass="SMIMEAssertionGui" testclass="SMIMEAssertion" testname="SMIME Assertion" enabled="true">
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/gridinit-jmeter.rb
CHANGED
@@ -4,114 +4,15 @@ require 'json'
|
|
4
4
|
require 'cgi'
|
5
5
|
require 'open3'
|
6
6
|
|
7
|
-
# DSL
|
8
|
-
require 'gridinit-jmeter/dsl'
|
9
7
|
require 'gridinit-jmeter/version'
|
8
|
+
require 'gridinit-jmeter/helpers/helper'
|
9
|
+
require 'gridinit-jmeter/helpers/parser'
|
10
10
|
require 'gridinit-jmeter/helpers/fallback_content_proxy'
|
11
|
-
require 'gridinit-jmeter/helpers/dsl_helper'
|
12
11
|
require 'gridinit-jmeter/helpers/logger-colors'
|
13
12
|
require 'gridinit-jmeter/helpers/strip-heredoc'
|
14
13
|
require 'gridinit-jmeter/helpers/user-agents'
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
require 'gridinit-jmeter/threads/thread_group'
|
21
|
-
# require 'gridinit-jmeter/threads/gc_stepping_thread_group'
|
22
|
-
# require 'gridinit-jmeter/threads/gc_ultimate_thread_group'
|
23
|
-
# require 'gridinit-jmeter/threads/set_up_group'
|
24
|
-
# require 'gridinit-jmeter/threads/tear_down_group'
|
25
|
-
|
26
|
-
# CONFIG ELEMENT
|
27
|
-
require 'gridinit-jmeter/config/counter_config'
|
28
|
-
# require 'gridinit-jmeter/config/csv_data_set_config'
|
29
|
-
# require 'gridinit-jmeter/config/ftp_request_defaults'
|
30
|
-
require 'gridinit-jmeter/config/auth_manager'
|
31
|
-
require 'gridinit-jmeter/config/cache_manager'
|
32
|
-
require 'gridinit-jmeter/config/cookie_manager'
|
33
|
-
require 'gridinit-jmeter/config/header_manager'
|
34
|
-
require 'gridinit-jmeter/config/request_defaults'
|
35
|
-
# require 'gridinit-jmeter/config/java_request_defaults'
|
36
|
-
# require 'gridinit-jmeter/config/jdbc_connection_configuration'
|
37
|
-
# require 'gridinit-jmeter/config/gc_lock_file_config'
|
38
|
-
# require 'gridinit-jmeter/config/gc_variables_from_csv_file'
|
39
|
-
# require 'gridinit-jmeter/config/keystore_configuration'
|
40
|
-
# require 'gridinit-jmeter/config/ldap_extended_request_defaults'
|
41
|
-
# require 'gridinit-jmeter/config/ldap_request_defaults'
|
42
|
-
# require 'gridinit-jmeter/config/login_config_element'
|
43
|
-
require 'gridinit-jmeter/config/random_variable'
|
44
|
-
# require 'gridinit-jmeter/config/simple_config_element'
|
45
|
-
# require 'gridinit-jmeter/config/tcp_sampler_config'
|
46
|
-
require 'gridinit-jmeter/config/user_defined_variable'
|
47
|
-
|
48
|
-
# TIMERS
|
49
|
-
# require 'gridinit-jmeter/timers/beanshell_timer'
|
50
|
-
# require 'gridinit-jmeter/timers/bsf_timer'
|
51
|
-
# require 'gridinit-jmeter/timers/constant_throughput_timer'
|
52
|
-
# require 'gridinit-jmeter/timers/constant_timer'
|
53
|
-
require 'gridinit-jmeter/timers/gaussian_random_timer'
|
54
|
-
require 'gridinit-jmeter/timers/gc_throughput_shaping_timer'
|
55
|
-
# require 'gridinit-jmeter/timers/jsr223_timer'
|
56
|
-
# require 'gridinit-jmeter/timers/poisson_random_timer'
|
57
|
-
# require 'gridinit-jmeter/timers/synchronizing_timer'
|
58
|
-
# require 'gridinit-jmeter/timers/uniform_random_timer'
|
59
|
-
|
60
|
-
# PRE PROCESSORS
|
61
|
-
require 'gridinit-jmeter/pre_processors/bean_shell_pre_processor'
|
62
|
-
# require 'gridinit-jmeter/pre_processors/bsf_pre_processor'
|
63
|
-
# require 'gridinit-jmeter/pre_processors/html_link_parser'
|
64
|
-
# require 'gridinit-jmeter/pre_processors/http_url_rewriter'
|
65
|
-
# require 'gridinit-jmeter/pre_processors/jdbc_pre_processor'
|
66
|
-
# require 'gridinit-jmeter/pre_processors/gc_inter_thread_pre_processor'
|
67
|
-
# require 'gridinit-jmeter/pre_processors/gc_raw_data_source_pre_processor'
|
68
|
-
# require 'gridinit-jmeter/pre_processors/jsr223_pre_processor'
|
69
|
-
# require 'gridinit-jmeter/pre_processors/user_parameters'
|
70
|
-
|
71
|
-
# POST PROCESSORS
|
72
|
-
# require 'gridinit-jmeter/post_processors/bean_shell_post_processor'
|
73
|
-
# require 'gridinit-jmeter/post_processors/bsf_post_processor'
|
74
|
-
# require 'gridinit-jmeter/post_processors/debug_post_processor'
|
75
|
-
# require 'gridinit-jmeter/post_processors/jdbc_post_processor'
|
76
|
-
# require 'gridinit-jmeter/post_processors/gc_inter_thread_communication_post_processor'
|
77
|
-
# require 'gridinit-jmeter/post_processors/jsr223_post_processor'
|
78
|
-
require 'gridinit-jmeter/post_processors/regex_extractor'
|
79
|
-
# require 'gridinit-jmeter/post_processors/result_status_action_handler'
|
80
|
-
require 'gridinit-jmeter/post_processors/xpath_extractor'
|
81
|
-
|
82
|
-
# ASSERTIONS
|
83
|
-
require 'gridinit-jmeter/assertions/response_assertion'
|
84
|
-
|
85
|
-
# LISTENERS
|
86
|
-
require 'gridinit-jmeter/listeners/view_results_full_visualizer'
|
87
|
-
require 'gridinit-jmeter/listeners/table_visualizer'
|
88
|
-
require 'gridinit-jmeter/listeners/graph_visualizer'
|
89
|
-
require 'gridinit-jmeter/listeners/response_time_graph_visualizer'
|
90
|
-
require 'gridinit-jmeter/listeners/stat_visualizer'
|
91
|
-
require 'gridinit-jmeter/listeners/simple_data_writer'
|
92
|
-
require 'gridinit-jmeter/listeners/summary_report'
|
93
|
-
require 'gridinit-jmeter/listeners/aggregate_report'
|
94
|
-
require 'gridinit-jmeter/listeners/gc_latencies_over_time'
|
95
|
-
require 'gridinit-jmeter/listeners/gc_response_codes_per_second'
|
96
|
-
require 'gridinit-jmeter/listeners/gc_response_times_distribution'
|
97
|
-
require 'gridinit-jmeter/listeners/gc_response_times_over_time'
|
98
|
-
require 'gridinit-jmeter/listeners/gc_response_times_percentiles'
|
99
|
-
require 'gridinit-jmeter/listeners/gc_transactions_per_second'
|
100
|
-
require 'gridinit-jmeter/listeners/gc_console_status_logger'
|
101
|
-
|
102
|
-
# LOGIC CONTROLLERS
|
103
|
-
require 'gridinit-jmeter/controllers/transaction'
|
104
|
-
require 'gridinit-jmeter/controllers/once_only'
|
105
|
-
require 'gridinit-jmeter/controllers/if_controller'
|
106
|
-
require 'gridinit-jmeter/controllers/loop_controller'
|
107
|
-
require 'gridinit-jmeter/controllers/throughput'
|
108
|
-
require 'gridinit-jmeter/controllers/while_controller'
|
109
|
-
require 'gridinit-jmeter/controllers/switch'
|
110
|
-
require 'gridinit-jmeter/controllers/random_order'
|
111
|
-
require 'gridinit-jmeter/controllers/simple'
|
112
|
-
require 'gridinit-jmeter/controllers/interleave'
|
113
|
-
|
114
|
-
# SAMPLERS
|
115
|
-
require 'gridinit-jmeter/samplers/http_sampler'
|
116
|
-
require 'gridinit-jmeter/samplers/ldap_ext_sampler'
|
117
|
-
require 'gridinit-jmeter/samplers/soap_sampler'
|
15
|
+
lib = File.dirname(File.absolute_path(__FILE__))
|
16
|
+
Dir.glob(lib + '/gridinit-jmeter/dsl/*', &method(:require))
|
17
|
+
Dir.glob(lib + '/gridinit-jmeter/plugins/*', &method(:require))
|
18
|
+
require 'gridinit-jmeter/dsl'
|