ruby-jmeter 2.13.10 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +2 -2
- data/LICENSE.txt +2 -2
- data/README.md +4 -5
- data/Rakefile +3 -3
- data/examples/{basic_os_process_sampler.rb → OS_process_sampler.rb} +1 -1
- data/examples/{basic_assertion_results.rb → assertion_results.rb} +1 -3
- data/examples/basic_auth.rb +1 -1
- data/examples/{basic_browser_headers.rb → browser_headers.rb} +1 -1
- data/examples/{basic_composite_graph.rb → composite_graph.rb} +1 -1
- data/examples/{basic_gc_dummy_sampler.rb → dummy_sampler.rb} +1 -3
- data/examples/{basic_duration_assertion.rb → duration_assertion.rb} +1 -1
- data/examples/etsy_login_browse.rb +1 -4
- data/examples/{basic_extract.rb → extract.rb} +1 -1
- data/examples/{basic_foreach.rb → foreach_controller.rb} +1 -4
- data/examples/{basic_header.rb → header_manager.rb} +2 -3
- data/examples/{basic_cache.rb → http_cache_manager.rb} +1 -1
- data/examples/{basic_cookies.rb → http_cookie_manager.rb} +1 -1
- data/examples/{basic_http_request_defaults.rb → http_request_defaults.rb} +3 -2
- data/examples/{basic_post.rb → http_request_post.rb} +1 -5
- data/examples/{basic_http_request_with_files.rb → http_request_with_files.rb} +1 -1
- data/examples/{basic_query_params.rb → http_request_with_query_params.rb} +1 -1
- data/examples/{basic_gc_results.rb → jmeter_plugins_graphs.rb} +1 -2
- data/examples/{basic_json_path_assertion.rb → json_path_assertions.rb} +1 -1
- data/examples/{basic_json_path_extractor.rb → json_path_extractor.rb} +1 -3
- data/examples/{basic_ldap_ext.rb → ldap_sampler.rb} +1 -1
- data/examples/{basic_loadosophia.rb → loadosophia.rb} +1 -1
- data/examples/{basic_loops.rb → loop_controller.rb} +2 -2
- data/examples/{basic_counter.rb → loops_with_counter.rb} +2 -2
- data/examples/{basic_perfmon.rb → perfmon.rb} +1 -1
- data/examples/real_page_objects.rb +1 -1
- data/examples/real_user_objects_github.rb +1 -1
- data/examples/regular_expression_extractor.rb +11 -0
- data/examples/{basic_assertion.rb → response_assertion.rb} +2 -1
- data/examples/{basic_response_time_percentiles_graph.rb → response_time_percentiles_graph.rb} +1 -2
- data/examples/{basic_simple_data_writer.rb → simple_data_writer_listener.rb} +1 -1
- data/examples/{basic_stepping_thread_group.rb → stepping_thread_group.rb} +1 -3
- data/examples/{basic_test_fragment.rb → test_fragment.rb} +1 -1
- data/examples/{basic_think_time.rb → think_time.rb} +2 -2
- data/examples/{basic_thread_groups.rb → thread_groups.rb} +1 -1
- data/examples/{basic_throughput_controller.rb → throughput_controller.rb} +1 -1
- data/examples/{basic_throughput_shaping_timer.rb → throughput_shaping_timer.rb} +1 -2
- data/examples/{basic_ultimate_thread_group.rb → ultimate_thread_group.rb} +1 -2
- data/examples/{basic_user_defined_variables.rb → user_defined_variables.rb} +1 -1
- data/examples/{basic_preprocessor_user_parameters.rb → user_parameters.rb} +7 -7
- data/lib/ruby-jmeter.rb +13 -8
- data/lib/ruby-jmeter/DSL.md +3 -1
- data/lib/ruby-jmeter/dsl.rb +11 -615
- data/lib/ruby-jmeter/dsl/foreach_controller.rb +0 -2
- data/lib/ruby-jmeter/dsl/html_parameter_mask.rb +3 -3
- data/lib/ruby-jmeter/dsl/http_request.rb +0 -2
- data/lib/ruby-jmeter/dsl/http_request_defaults.rb +0 -1
- data/lib/ruby-jmeter/dsl/jms_publisher.rb +2 -0
- data/lib/ruby-jmeter/dsl/regular_expression_extractor.rb +1 -3
- data/lib/ruby-jmeter/dsl/response_assertion.rb +0 -1
- data/lib/ruby-jmeter/dsl/test_fragment.rb +1 -1
- data/lib/ruby-jmeter/dsl/user_parameters.rb +3 -1
- data/lib/ruby-jmeter/extend/assertions/response_assertion.rb +36 -0
- data/lib/ruby-jmeter/extend/config_elements/header_manager.rb +13 -0
- data/lib/ruby-jmeter/extend/config_elements/http_cache_manager.rb +11 -0
- data/lib/ruby-jmeter/extend/config_elements/http_cookie_manager.rb +11 -0
- data/lib/ruby-jmeter/extend/config_elements/http_request_defaults.rb +28 -0
- data/lib/ruby-jmeter/extend/config_elements/user_defined_variables.rb +13 -0
- data/lib/ruby-jmeter/extend/config_elements/user_parameters.rb +31 -0
- data/lib/ruby-jmeter/extend/controllers/foreach_controller.rb +25 -0
- data/lib/ruby-jmeter/extend/controllers/loop_controller.rb +11 -0
- data/lib/ruby-jmeter/extend/controllers/module_controller.rb +23 -0
- data/lib/ruby-jmeter/extend/controllers/throughput_controller.rb +15 -0
- data/lib/ruby-jmeter/extend/controllers/transaction_controller.rb +14 -0
- data/lib/ruby-jmeter/extend/misc/aliases.rb +21 -0
- data/lib/ruby-jmeter/extend/misc/exists.rb +13 -0
- data/lib/ruby-jmeter/extend/misc/flood.rb +48 -0
- data/lib/ruby-jmeter/extend/misc/with_helpers.rb +27 -0
- data/lib/ruby-jmeter/extend/plugins/jmeter_plugins.rb +115 -0
- data/lib/ruby-jmeter/extend/processors/extract.rb +28 -0
- data/lib/ruby-jmeter/extend/processors/regular_expression_extractor.rb +25 -0
- data/lib/ruby-jmeter/extend/samplers/http_request.rb +47 -0
- data/lib/ruby-jmeter/extend/samplers/soapxmlrpc_request.rb +9 -0
- data/lib/ruby-jmeter/extend/threads/setup_thread_group.rb +18 -0
- data/lib/ruby-jmeter/extend/threads/thread_group.rb +19 -0
- data/lib/ruby-jmeter/extend/timers/constant_throughput_timer.rb +12 -0
- data/lib/ruby-jmeter/extend/timers/random_timer.rb +14 -0
- data/lib/ruby-jmeter/helpers/helper.rb +1 -2
- data/lib/ruby-jmeter/idl.xml +6 -4
- data/lib/ruby-jmeter/version.rb +1 -1
- data/ruby-jmeter.gemspec +7 -7
- data/spec/constant_throughput_timer_spec.rb +22 -0
- data/spec/header_manager_spec.rb +37 -0
- data/spec/http_cache_manager_spec.rb +17 -0
- data/spec/http_cookie_manager_spec.rb +17 -0
- data/spec/http_request_defaults_spec.rb +47 -0
- data/spec/http_request_spec.rb +305 -0
- data/spec/jmeter_plugins_spec.rb +155 -0
- data/spec/json_extractor_spec.rb +19 -0
- data/spec/json_path_assertion_spec.rb +28 -0
- data/spec/logic_controller_spec.rb +148 -0
- data/spec/loop_controller_spec.rb +19 -0
- data/spec/module_controller_spec.rb +56 -0
- data/spec/regular_expression_extractor_spec.rb +63 -0
- data/spec/response_assertion_spec.rb +69 -0
- data/spec/setup_thread_group_spec.rb +31 -0
- data/spec/thread_group_spec.rb +57 -0
- data/spec/throughput_controller_spec.rb +24 -0
- data/spec/transaction_controller_spec.rb +30 -0
- data/spec/user_defined_variables_spec.rb +22 -0
- data/spec/user_parameters_spec.rb +45 -0
- data/spec/with_helpers_spec.rb +57 -0
- data/spec/xpath_extractor_spec.rb +15 -0
- metadata +87 -59
- data/examples/basic_flood.rb +0 -12
- data/examples/basic_flood_real.rb +0 -7
- data/examples/basic_flood_with_csv.rb +0 -16
- data/examples/basic_google.rb +0 -8
- data/examples/basic_har.json +0 -4252
- data/examples/basic_har.rb +0 -34
- data/examples/basic_meta_fu.rb +0 -63
- data/examples/basic_response_assertion.rb +0 -13
- data/examples/basic_run.rb +0 -12
- data/examples/basic_testdata.rb +0 -60
- data/examples/demo.csv +0 -3
- data/examples/real_flood_test.rb +0 -14
- data/examples/real_flood_test_data.rb +0 -15
- data/examples/real_immi.gov.au_visa.rb +0 -78
- data/lib/ruby-jmeter/helpers/jmeter.properties +0 -28
- data/spec/dsl_spec.rb +0 -1157
- data/spec/stub.rb +0 -31
@@ -0,0 +1,27 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def with_user_agent(device)
|
4
|
+
http_header_manager name: 'User-Agent', value: RubyJmeter::UserAgent.new(device).string
|
5
|
+
end
|
6
|
+
|
7
|
+
def with_browser(device)
|
8
|
+
http_header_manager name: 'User-Agent', value: RubyJmeter::UserAgent.new(device).string
|
9
|
+
http_header_manager [
|
10
|
+
{ name: 'Accept-Encoding', value: 'gzip,deflate,sdch' },
|
11
|
+
{ name: 'Accept', value: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' }
|
12
|
+
]
|
13
|
+
end
|
14
|
+
|
15
|
+
def with_xhr
|
16
|
+
http_header_manager name: 'X-Requested-With', value: 'XMLHttpRequest'
|
17
|
+
end
|
18
|
+
|
19
|
+
def with_gzip
|
20
|
+
http_header_manager name: 'Accept-Encoding', value: 'gzip, deflate'
|
21
|
+
end
|
22
|
+
|
23
|
+
def with_json
|
24
|
+
http_header_manager name: 'Accept', value: 'text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8, application/json'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def response_codes_per_second(name = 'Response Codes per Second', params = {}, &block)
|
4
|
+
node = RubyJmeter::Plugins::ResponseCodesPerSecond.new(name, params)
|
5
|
+
attach_node(node, &block)
|
6
|
+
end
|
7
|
+
|
8
|
+
def response_times_distribution(name = 'Response Times Distribution', params = {}, &block)
|
9
|
+
node = RubyJmeter::Plugins::ResponseTimesDistribution.new(name, params)
|
10
|
+
attach_node(node, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def response_times_over_time(name = 'Response Times Over Time', params = {}, &block)
|
14
|
+
node = RubyJmeter::Plugins::ResponseTimesOverTime.new(name, params)
|
15
|
+
attach_node(node, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def response_times_percentiles(name = 'Response Times Percentiles', params = {}, &block)
|
19
|
+
node = RubyJmeter::Plugins::ResponseTimesPercentiles.new(name, params)
|
20
|
+
attach_node(node, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def transactions_per_second(name = 'Transactions per Second', params = {}, &block)
|
24
|
+
node = RubyJmeter::Plugins::TransactionsPerSecond.new(name, params)
|
25
|
+
attach_node(node, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def latencies_over_time(name = 'Response Latencies Over Time', params = {}, &block)
|
29
|
+
node = RubyJmeter::Plugins::LatenciesOverTime.new(name, params)
|
30
|
+
attach_node(node, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def console_status_logger(name = 'Console Status Logger', params = {}, &block)
|
34
|
+
node = RubyJmeter::Plugins::ConsoleStatusLogger.new(name, params)
|
35
|
+
attach_node(node, &block)
|
36
|
+
end
|
37
|
+
|
38
|
+
alias console console_status_logger
|
39
|
+
|
40
|
+
def throughput_shaper(name = 'Throughput Shaping Timer', steps=[], params = {}, &block)
|
41
|
+
node = RubyJmeter::Plugins::ThroughputShapingTimer.new(name, steps)
|
42
|
+
attach_node(node, &block)
|
43
|
+
end
|
44
|
+
|
45
|
+
alias shaper throughput_shaper
|
46
|
+
|
47
|
+
def dummy_sampler(name = 'Dummy Sampler', params = {}, &block)
|
48
|
+
node = RubyJmeter::Plugins::DummySampler.new(name, params)
|
49
|
+
attach_node(node, &block)
|
50
|
+
end
|
51
|
+
|
52
|
+
alias dummy dummy_sampler
|
53
|
+
|
54
|
+
def stepping_thread_group(params = {}, &block)
|
55
|
+
node = RubyJmeter::Plugins::SteppingThreadGroup.new(params)
|
56
|
+
attach_node(node, &block)
|
57
|
+
end
|
58
|
+
|
59
|
+
alias step stepping_thread_group
|
60
|
+
|
61
|
+
def ultimate_thread_group(threads = [], params = {}, &block)
|
62
|
+
node = RubyJmeter::Plugins::UltimateThreadGroup.new(params)
|
63
|
+
|
64
|
+
threads.each_with_index do |group, index|
|
65
|
+
node.doc.at_xpath('//collectionProp') <<
|
66
|
+
Nokogiri::XML(<<-EOS.strip_heredoc).children
|
67
|
+
<collectionProp name="index">
|
68
|
+
<stringProp name="#{group[:start_threads]}">#{group[:start_threads]}</stringProp>
|
69
|
+
<stringProp name="#{group[:initial_delay]}">#{group[:initial_delay]}</stringProp>
|
70
|
+
<stringProp name="#{group[:start_time]}">#{group[:start_time]}</stringProp>
|
71
|
+
<stringProp name="#{group[:hold_time]}">#{group[:hold_time]}</stringProp>
|
72
|
+
<stringProp name="#{group[:stop_time]}">#{group[:stop_time]}</stringProp>
|
73
|
+
</collectionProp>
|
74
|
+
EOS
|
75
|
+
end
|
76
|
+
|
77
|
+
attach_node(node, &block)
|
78
|
+
end
|
79
|
+
|
80
|
+
alias ultimate ultimate_thread_group
|
81
|
+
|
82
|
+
def composite_graph(name, params = {}, &block)
|
83
|
+
node = RubyJmeter::Plugins::CompositeGraph.new(name, params)
|
84
|
+
attach_node(node, &block)
|
85
|
+
end
|
86
|
+
|
87
|
+
alias composite composite_graph
|
88
|
+
|
89
|
+
def active_threads_over_time(params = {}, &block)
|
90
|
+
node = RubyJmeter::Plugins::ActiveThreadsOverTime.new(params)
|
91
|
+
attach_node(node, &block)
|
92
|
+
end
|
93
|
+
|
94
|
+
alias active_threads active_threads_over_time
|
95
|
+
|
96
|
+
def perfmon_collector(params = {}, &block)
|
97
|
+
node = RubyJmeter::Plugins::PerfmonCollector.new(params)
|
98
|
+
attach_node(node, &block)
|
99
|
+
end
|
100
|
+
|
101
|
+
alias perfmon perfmon_collector
|
102
|
+
|
103
|
+
def loadosophia_uploader(name = "Loadosophia.org Uploader", params = {}, &block)
|
104
|
+
node = RubyJmeter::Plugins::LoadosophiaUploader.new(name, params)
|
105
|
+
attach_node(node, &block)
|
106
|
+
end
|
107
|
+
|
108
|
+
alias loadosophia loadosophia_uploader
|
109
|
+
|
110
|
+
def redis_data_set(params = {}, &block)
|
111
|
+
node = RubyJmeter::Plugins::RedisDataSet.new(params)
|
112
|
+
attach_node(node, &block)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def extract(params, &block)
|
4
|
+
node = if params[:regex]
|
5
|
+
params[:refname] = params[:name]
|
6
|
+
params[:regex] = params[:regex] #CGI.escapeHTML
|
7
|
+
params[:template] = params[:template] || "$1$"
|
8
|
+
RubyJmeter::RegularExpressionExtractor.new(params)
|
9
|
+
elsif params[:xpath]
|
10
|
+
params[:refname] = params[:name]
|
11
|
+
params[:xpathQuery] = params[:xpath]
|
12
|
+
RubyJmeter::XpathExtractor.new(params)
|
13
|
+
elsif params[:json]
|
14
|
+
params[:VAR] = params[:name]
|
15
|
+
params[:JSONPATH] = params[:json]
|
16
|
+
RubyJmeter::Plugins::JsonPathExtractor.new(params)
|
17
|
+
elsif params[:css]
|
18
|
+
params[:refname] = params[:name]
|
19
|
+
params[:expr] = params[:css]
|
20
|
+
RubyJmeter::CssjqueryExtractor.new(params)
|
21
|
+
end
|
22
|
+
|
23
|
+
attach_node(node, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
alias web_reg_save_param extract
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def regular_expression_extractor(params, &block)
|
4
|
+
params[:refname] = params[:name]
|
5
|
+
params[:regex] = params[:pattern]
|
6
|
+
params[:template] = params[:template] || "$1$"
|
7
|
+
|
8
|
+
node = RubyJmeter::RegularExpressionExtractor.new(params).tap do |node|
|
9
|
+
if params[:variable]
|
10
|
+
node.doc.xpath("//stringProp[@name='Sample.scope']").first.content = 'variable'
|
11
|
+
|
12
|
+
node.doc.children.first.add_child (
|
13
|
+
Nokogiri::XML(<<-EOS.strip_heredoc).children
|
14
|
+
<stringProp name="Scope.variable">#{params[:variable]}</stringProp>
|
15
|
+
EOS
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
attach_node(node, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
alias regex regular_expression_extractor
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def http_request(*args, &block)
|
4
|
+
params = args.shift || {}
|
5
|
+
params = { url: params }.merge(args.shift || {}) if params.class == String
|
6
|
+
|
7
|
+
params[:method] ||= case __callee__.to_s
|
8
|
+
when 'visit'
|
9
|
+
'GET'
|
10
|
+
when 'submit'
|
11
|
+
'POST'
|
12
|
+
else
|
13
|
+
__callee__.to_s.upcase
|
14
|
+
end
|
15
|
+
|
16
|
+
params[:name] ||= params[:url]
|
17
|
+
|
18
|
+
parse_http_request(params)
|
19
|
+
|
20
|
+
node = RubyJmeter::HttpRequest.new(params).tap do |node|
|
21
|
+
node.doc.children.first.add_child (
|
22
|
+
Nokogiri::XML(<<-EOS.strip_heredoc).children
|
23
|
+
<stringProp name="HTTPSampler.implementation">#{params[:implementation]}</stringProp>
|
24
|
+
EOS
|
25
|
+
) if params[:implementation]
|
26
|
+
|
27
|
+
node.doc.children.first.add_child (
|
28
|
+
Nokogiri::XML(<<-EOS.strip_heredoc).children
|
29
|
+
<stringProp name="TestPlan.comments">#{params[:comments]}</stringProp>
|
30
|
+
EOS
|
31
|
+
) if params[:comments]
|
32
|
+
end
|
33
|
+
|
34
|
+
attach_node(node, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
alias request http_request
|
38
|
+
alias get http_request
|
39
|
+
alias visit http_request
|
40
|
+
alias post http_request
|
41
|
+
alias submit http_request
|
42
|
+
alias delete http_request
|
43
|
+
alias patch http_request
|
44
|
+
alias put http_request
|
45
|
+
alias head http_request
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def setup_thread_group(*args, &block)
|
4
|
+
params = args.shift || {}
|
5
|
+
params = { count: params }.merge(args.shift || {}) if params.class == Fixnum
|
6
|
+
params[:num_threads] = params[:count] || 1
|
7
|
+
params[:ramp_time] = params[:rampup] || (params[:num_threads]/2.0).ceil
|
8
|
+
params[:start_time] = params[:start_time] || Time.now.to_i * 1000
|
9
|
+
params[:end_time] = params[:end_time] || Time.now.to_i * 1000
|
10
|
+
params[:duration] ||= 60
|
11
|
+
params[:continue_forever] ||= false
|
12
|
+
params[:loops] = -1 if params[:continue_forever]
|
13
|
+
node = RubyJmeter::SetupThreadGroup.new(params)
|
14
|
+
|
15
|
+
attach_node(node, &block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def thread_group(*args, &block)
|
4
|
+
params = args.shift || {}
|
5
|
+
params = { count: params }.merge(args.shift || {}) if params.class == Fixnum
|
6
|
+
params[:num_threads] = params[:count] || 1
|
7
|
+
params[:ramp_time] = params[:rampup] || (params[:num_threads]/2.0).ceil
|
8
|
+
params[:start_time] = params[:start_time] || Time.now.to_i * 1000
|
9
|
+
params[:end_time] = params[:end_time] || Time.now.to_i * 1000
|
10
|
+
params[:duration] ||= 60
|
11
|
+
params[:continue_forever] ||= false
|
12
|
+
params[:loops] = -1 if params[:continue_forever]
|
13
|
+
node = RubyJmeter::ThreadGroup.new(params)
|
14
|
+
attach_node(node, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
alias threads thread_group
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def constant_throughput_timer(params, &block)
|
4
|
+
params[:value] ||= params[:throughput] || 0.0
|
5
|
+
|
6
|
+
node = RubyJmeter::ConstantThroughputTimer.new(params)
|
7
|
+
node.doc.xpath('.//value').first.content = params[:value].to_f
|
8
|
+
|
9
|
+
attach_node(node, &block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
class ExtendedDSL < DSL
|
3
|
+
def random_timer(delay=0, range=0, &block)
|
4
|
+
params = {}
|
5
|
+
params[:delay] = delay
|
6
|
+
params[:range] = range
|
7
|
+
node = RubyJmeter::GaussianRandomTimer.new(params)
|
8
|
+
|
9
|
+
attach_node(node, &block)
|
10
|
+
end
|
11
|
+
|
12
|
+
alias think_time random_timer
|
13
|
+
end
|
14
|
+
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module RubyJmeter
|
2
|
-
|
3
2
|
def dsl_eval(dsl, &block)
|
4
3
|
block_context = eval("self", block.binding)
|
5
4
|
proxy_context = RubyJmeter::FallbackContextProxy.new(dsl, block_context)
|
@@ -24,7 +23,7 @@ module RubyJmeter
|
|
24
23
|
params.each do |name, value|
|
25
24
|
node = @doc.children.xpath("//*[contains(@name,\"#{name.to_s}\")]")
|
26
25
|
if value.class == Nokogiri::XML::Builder
|
27
|
-
node.first
|
26
|
+
node.first.children = value.doc.at_xpath('//builder').children
|
28
27
|
else
|
29
28
|
node.first.content = value unless node.empty?
|
30
29
|
end
|
data/lib/ruby-jmeter/idl.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<jmeterTestPlan version="1.2" properties="2.
|
2
|
+
<jmeterTestPlan version="1.2" properties="2.9" jmeter="3.0 r1743807">
|
3
3
|
<hashTree>
|
4
4
|
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
|
5
5
|
<stringProp name="TestPlan.comments"></stringProp>
|
@@ -395,8 +395,8 @@
|
|
395
395
|
<hashTree/>
|
396
396
|
<AnchorModifier guiclass="AnchorModifierGui" testclass="AnchorModifier" testname="HTML Link Parser" enabled="true"/>
|
397
397
|
<hashTree/>
|
398
|
-
<
|
399
|
-
<elementProp name="ParamModifier.mask" elementType="
|
398
|
+
<ConfigTestElement guiclass="ObsoleteGui" testclass="ConfigTestElement" testname="HTML Parameter Mask" enabled="true">
|
399
|
+
<elementProp name="ParamModifier.mask" elementType="ConfigTestElement">
|
400
400
|
<stringProp name="ParamModifier.field_name"></stringProp>
|
401
401
|
<stringProp name="ParamModifier.prefix"></stringProp>
|
402
402
|
<longProp name="ParamModifier.lower_bound">0</longProp>
|
@@ -404,7 +404,7 @@
|
|
404
404
|
<longProp name="ParamModifier.increment">1</longProp>
|
405
405
|
<stringProp name="ParamModifier.suffix"></stringProp>
|
406
406
|
</elementProp>
|
407
|
-
</
|
407
|
+
</ConfigTestElement>
|
408
408
|
<hashTree/>
|
409
409
|
<URLRewritingModifier guiclass="URLRewritingModifierGui" testclass="URLRewritingModifier" testname="HTTP URL Re-writing Modifier" enabled="true">
|
410
410
|
<stringProp name="argument_name"></stringProp>
|
@@ -643,6 +643,8 @@
|
|
643
643
|
</elementProp>
|
644
644
|
</collectionProp>
|
645
645
|
</elementProp>
|
646
|
+
<stringProp name="jms.expiration"></stringProp>
|
647
|
+
<stringProp name="jms.priority"></stringProp>
|
646
648
|
</PublisherSampler>
|
647
649
|
<hashTree/>
|
648
650
|
<SubscriberSampler guiclass="JMSSubscriberGui" testclass="SubscriberSampler" testname="JMS Subscriber" enabled="true">
|
data/lib/ruby-jmeter/version.rb
CHANGED
data/ruby-jmeter.gemspec
CHANGED
@@ -4,20 +4,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'ruby-jmeter/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
|
-
gem.name =
|
7
|
+
gem.name = 'ruby-jmeter'
|
8
8
|
gem.version = RubyJmeter::VERSION
|
9
|
-
gem.authors = [
|
10
|
-
gem.email = [
|
9
|
+
gem.authors = ['Tim Koopmans']
|
10
|
+
gem.email = ['support@flood.io']
|
11
11
|
gem.description = %q{Ruby based DSL for writing JMeter test plans}
|
12
12
|
gem.summary = %q{Ruby based DSL for writing JMeter test plans}
|
13
|
-
gem.homepage =
|
14
|
-
gem.add_dependency(
|
15
|
-
gem.add_dependency(
|
13
|
+
gem.homepage = 'http://flood-io.github.io/ruby-jmeter/'
|
14
|
+
gem.add_dependency('rest-client')
|
15
|
+
gem.add_dependency('nokogiri')
|
16
16
|
gem.add_runtime_dependency('json-jruby') if RUBY_PLATFORM == 'java'
|
17
17
|
|
18
18
|
gem.files = `git ls-files`.split($/)
|
19
19
|
gem.executables << 'flood'
|
20
|
-
gem.test_files = `git ls-files -- {
|
20
|
+
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
21
21
|
gem.require_paths = ['lib']
|
22
22
|
|
23
23
|
gem.license = 'MIT'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'constant_throughput_timer' do
|
4
|
+
let(:doc) do
|
5
|
+
test do
|
6
|
+
threads do
|
7
|
+
constant_throughput_timer value: 60.0
|
8
|
+
constant_throughput_timer throughput: 70.0
|
9
|
+
end
|
10
|
+
end.to_doc
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:fragment) { doc.search("//ConstantThroughputTimer").first }
|
14
|
+
|
15
|
+
it 'should match on throughput using value' do
|
16
|
+
expect(fragment.search("//doubleProp/value").first.text).to eq '60.0'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should match on throughput using throughput' do
|
20
|
+
expect(fragment.search("//doubleProp/value").last.text).to eq '70.0'
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'header manager' do
|
4
|
+
let(:doc) do
|
5
|
+
test do
|
6
|
+
header name: 'Accept', value: '*'
|
7
|
+
end.to_doc
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:fragment) { doc.search('//HeaderManager').first }
|
11
|
+
|
12
|
+
it 'should match on accept' do
|
13
|
+
expect(fragment.search(".//stringProp[@name='Header.name']").text).to eq 'Accept'
|
14
|
+
expect(fragment.search(".//stringProp[@name='Header.value']").text).to eq '*'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'header manager multiple values' do
|
19
|
+
let(:doc) do
|
20
|
+
test do
|
21
|
+
header [ { name: 'Accept', value: '1' }, { name: 'Accept', value: '2' }]
|
22
|
+
end.to_doc
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:fragment) { doc.search('//HeaderManager') }
|
26
|
+
|
27
|
+
|
28
|
+
it 'should match on accept for fragment_first' do
|
29
|
+
expect(fragment.search(".//stringProp[@name='Header.name']").first.text).to eq 'Accept'
|
30
|
+
expect(fragment.search(".//stringProp[@name='Header.value']").first.text).to eq '1'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should match on accept for fragment_last' do
|
34
|
+
expect(fragment.search(".//stringProp[@name='Header.name']").last.text).to eq 'Accept'
|
35
|
+
expect(fragment.search(".//stringProp[@name='Header.value']").last.text).to eq '2'
|
36
|
+
end
|
37
|
+
end
|