ruby-jmeter 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/basic_header.rb +5 -1
- data/examples/basic_user_defined_variables.rb +10 -0
- data/lib/ruby-jmeter/dsl/access_log_sampler.rb +3 -3
- data/lib/ruby-jmeter/dsl/aggregate_graph.rb +3 -3
- data/lib/ruby-jmeter/dsl/aggregate_report.rb +3 -3
- data/lib/ruby-jmeter/dsl/ajp13_sampler.rb +4 -4
- data/lib/ruby-jmeter/dsl/assertion_results.rb +3 -3
- data/lib/ruby-jmeter/dsl/beanshell_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/beanshell_listener.rb +3 -3
- data/lib/ruby-jmeter/dsl/beanshell_postprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/beanshell_preprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/beanshell_sampler.rb +3 -3
- data/lib/ruby-jmeter/dsl/beanshell_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/bsf_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/bsf_listener.rb +3 -3
- data/lib/ruby-jmeter/dsl/bsf_postprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/bsf_preprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/bsf_sampler.rb +3 -3
- data/lib/ruby-jmeter/dsl/bsf_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/compare_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/comparison_assertion_visualizer.rb +3 -3
- data/lib/ruby-jmeter/dsl/constant_throughput_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/constant_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/counter.rb +3 -3
- data/lib/ruby-jmeter/dsl/cssjquery_extractor.rb +3 -3
- data/lib/ruby-jmeter/dsl/csv_data_set_config.rb +3 -3
- data/lib/ruby-jmeter/dsl/debug_postprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/debug_sampler.rb +3 -3
- data/lib/ruby-jmeter/dsl/distribution_graphalpha.rb +3 -3
- data/lib/ruby-jmeter/dsl/duration_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/foreach_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/ftp_request.rb +3 -3
- data/lib/ruby-jmeter/dsl/ftp_request_defaults.rb +3 -3
- data/lib/ruby-jmeter/dsl/gaussian_random_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/generate_summary_results.rb +3 -3
- data/lib/ruby-jmeter/dsl/graph_results.rb +3 -3
- data/lib/ruby-jmeter/dsl/html_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/html_link_parser.rb +3 -3
- data/lib/ruby-jmeter/dsl/html_parameter_mask.rb +3 -3
- data/lib/ruby-jmeter/dsl/http_authorization_manager.rb +3 -3
- data/lib/ruby-jmeter/dsl/http_cache_manager.rb +3 -3
- data/lib/ruby-jmeter/dsl/http_cookie_manager.rb +3 -3
- data/lib/ruby-jmeter/dsl/http_header_manager.rb +3 -3
- data/lib/ruby-jmeter/dsl/http_request.rb +4 -4
- data/lib/ruby-jmeter/dsl/http_request_defaults.rb +4 -4
- data/lib/ruby-jmeter/dsl/http_url_rewriting_modifier.rb +3 -3
- data/lib/ruby-jmeter/dsl/if_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/include_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/java_request.rb +3 -3
- data/lib/ruby-jmeter/dsl/java_request_defaults.rb +3 -3
- data/lib/ruby-jmeter/dsl/jdbc_connection_configuration.rb +3 -3
- data/lib/ruby-jmeter/dsl/jdbc_postprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/jdbc_preprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/jdbc_request.rb +3 -3
- data/lib/ruby-jmeter/dsl/jms_pointtopoint.rb +5 -5
- data/lib/ruby-jmeter/dsl/jms_publisher.rb +4 -4
- data/lib/ruby-jmeter/dsl/jms_subscriber.rb +3 -3
- data/lib/ruby-jmeter/dsl/jsr223_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/jsr223_listener.rb +3 -3
- data/lib/ruby-jmeter/dsl/jsr223_postprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/jsr223_preprocessor.rb +3 -3
- data/lib/ruby-jmeter/dsl/jsr223_sampler.rb +3 -3
- data/lib/ruby-jmeter/dsl/jsr223_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/junit_request.rb +3 -3
- data/lib/ruby-jmeter/dsl/keystore_configuration.rb +3 -3
- data/lib/ruby-jmeter/dsl/ldap_extended_request.rb +3 -3
- data/lib/ruby-jmeter/dsl/ldap_extended_request_defaults.rb +3 -3
- data/lib/ruby-jmeter/dsl/ldap_request.rb +4 -4
- data/lib/ruby-jmeter/dsl/ldap_request_defaults.rb +4 -4
- data/lib/ruby-jmeter/dsl/login_config_element.rb +3 -3
- data/lib/ruby-jmeter/dsl/loop_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/mail_reader_sampler.rb +3 -3
- data/lib/ruby-jmeter/dsl/mailer_visualizer.rb +3 -3
- data/lib/ruby-jmeter/dsl/md5hex_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/module_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/monitor_results.rb +3 -3
- data/lib/ruby-jmeter/dsl/once_only_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/os_process_sampler.rb +5 -5
- data/lib/ruby-jmeter/dsl/poisson_random_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/random_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/random_order_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/random_variable.rb +3 -3
- data/lib/ruby-jmeter/dsl/recording_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/regex_user_parameters.rb +3 -3
- data/lib/ruby-jmeter/dsl/regular_expression_extractor.rb +3 -3
- data/lib/ruby-jmeter/dsl/response_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/response_time_graph.rb +3 -3
- data/lib/ruby-jmeter/dsl/result_status_action_handler.rb +3 -3
- data/lib/ruby-jmeter/dsl/runtime_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/save_responses_to_a_file.rb +3 -3
- data/lib/ruby-jmeter/dsl/simple_config_element.rb +3 -3
- data/lib/ruby-jmeter/dsl/simple_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/simple_data_writer.rb +3 -3
- data/lib/ruby-jmeter/dsl/smime_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/smtp_sampler.rb +3 -3
- data/lib/ruby-jmeter/dsl/soapxmlrpc_request.rb +3 -3
- data/lib/ruby-jmeter/dsl/spline_visualizer.rb +3 -3
- data/lib/ruby-jmeter/dsl/summary_report.rb +3 -3
- data/lib/ruby-jmeter/dsl/switch_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/synchronizing_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/tcp_sampler.rb +3 -3
- data/lib/ruby-jmeter/dsl/tcp_sampler_config.rb +3 -3
- data/lib/ruby-jmeter/dsl/test_action.rb +3 -3
- data/lib/ruby-jmeter/dsl/test_plan.rb +4 -4
- data/lib/ruby-jmeter/dsl/thread_group.rb +4 -4
- data/lib/ruby-jmeter/dsl/throughput_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/transaction_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/uniform_random_timer.rb +3 -3
- data/lib/ruby-jmeter/dsl/user_defined_variables.rb +3 -3
- data/lib/ruby-jmeter/dsl/user_parameters.rb +3 -3
- data/lib/ruby-jmeter/dsl/view_results_in_table.rb +3 -3
- data/lib/ruby-jmeter/dsl/view_results_tree.rb +3 -3
- data/lib/ruby-jmeter/dsl/while_controller.rb +3 -3
- data/lib/ruby-jmeter/dsl/xml_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/xml_schema_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/xpath_assertion.rb +3 -3
- data/lib/ruby-jmeter/dsl/xpath_extractor.rb +3 -3
- data/lib/ruby-jmeter/dsl.rb +6 -2
- data/lib/ruby-jmeter/helpers/helper.rb +20 -3
- data/lib/ruby-jmeter/idl.rb +3 -3
- data/lib/ruby-jmeter/version.rb +1 -1
- data/spec/dsl_spec.rb +22 -0
- metadata +4 -6
data/lib/ruby-jmeter/dsl.rb
CHANGED
@@ -25,7 +25,9 @@ module RubyJmeter
|
|
25
25
|
# Config Elements
|
26
26
|
|
27
27
|
def user_defined_variables(params, &block)
|
28
|
-
params
|
28
|
+
if params.is_a?(Hash)
|
29
|
+
params['Argument.name'] = params[:name]
|
30
|
+
end
|
29
31
|
super
|
30
32
|
end
|
31
33
|
|
@@ -53,7 +55,9 @@ module RubyJmeter
|
|
53
55
|
end
|
54
56
|
|
55
57
|
def http_header_manager(params, &block)
|
56
|
-
params
|
58
|
+
if params.is_a?(Hash)
|
59
|
+
params['Header.name'] = params[:name]
|
60
|
+
end
|
57
61
|
super
|
58
62
|
end
|
59
63
|
|
@@ -17,9 +17,13 @@ module RubyJmeter
|
|
17
17
|
module Helper
|
18
18
|
def update(params)
|
19
19
|
params.delete(:name)
|
20
|
-
params.
|
21
|
-
|
22
|
-
|
20
|
+
if params.class == Array
|
21
|
+
update_collection params
|
22
|
+
else
|
23
|
+
params.each do |name, value|
|
24
|
+
node = @doc.children.xpath("//*[contains(@name,\"#{name.to_s}\")]")
|
25
|
+
node.first.content = value unless node.empty?
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
@@ -29,6 +33,19 @@ module RubyJmeter
|
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
36
|
+
def update_collection(params)
|
37
|
+
elements = @doc.at_xpath("//collectionProp/elementProp")
|
38
|
+
params.each_with_index do |param, index|
|
39
|
+
param.each do |name, value|
|
40
|
+
element = elements.element_children.xpath("//*[contains(@name,\"#{name}\")]")
|
41
|
+
element.last.content = value
|
42
|
+
end
|
43
|
+
if index != params.size - 1
|
44
|
+
@doc.at_xpath("//collectionProp") << elements.dup
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
32
49
|
def enabled(params)
|
33
50
|
#default to true unless explicitly set to false
|
34
51
|
if params.has_key?(:enabled) && params[:enabled] == false
|
data/lib/ruby-jmeter/idl.rb
CHANGED
@@ -53,12 +53,12 @@ module RubyJmeter
|
|
53
53
|
include Helper
|
54
54
|
|
55
55
|
def initialize(params={})
|
56
|
-
params[:name]
|
56
|
+
testname = params.kind_of?(Array) ? '#{klass}' : (params[:name] || '#{klass}')
|
57
57
|
@doc = Nokogiri::XML(<<-EOS.strip_heredoc)
|
58
|
-
#{element.to_xml.gsub /testname=".+?"/, 'testname="#{
|
58
|
+
#{element.to_xml.gsub /testname=".+?"/, 'testname="#{testname}"'})
|
59
59
|
EOS
|
60
60
|
update params
|
61
|
-
update_at_xpath params if params[:update_at_xpath]
|
61
|
+
update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
data/lib/ruby-jmeter/version.rb
CHANGED
data/spec/dsl_spec.rb
CHANGED
@@ -65,6 +65,28 @@ describe "DSL" do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
|
69
|
+
describe 'header manager multiple values' do
|
70
|
+
let(:doc) do
|
71
|
+
test do
|
72
|
+
header [ { name: 'Accept', value: '1' }, { name: 'Accept', value: '2' }]
|
73
|
+
end.to_doc
|
74
|
+
end
|
75
|
+
|
76
|
+
let(:fragment) { doc.search("//HeaderManager") }
|
77
|
+
|
78
|
+
|
79
|
+
it 'should match on accept for fragment_first' do
|
80
|
+
fragment.search(".//stringProp[@name='Header.name']").first.text.should == 'Accept'
|
81
|
+
fragment.search(".//stringProp[@name='Header.value']").first.text.should == '1'
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should match on accept for fragment_last' do
|
85
|
+
fragment.search(".//stringProp[@name='Header.name']").last.text.should == 'Accept'
|
86
|
+
fragment.search(".//stringProp[@name='Header.value']").last.text.should == '2'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
68
90
|
describe 'test plan' do
|
69
91
|
it 'should allow to take params' do
|
70
92
|
test_plan = test({"TestPlan.serialize_threadgroups" => "false"}) {}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-jmeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- examples/basic_think_time.rb
|
79
79
|
- examples/basic_throughput_controller.rb
|
80
80
|
- examples/basic_throughput_shaping_timer.rb
|
81
|
+
- examples/basic_user_defined_variables.rb
|
81
82
|
- examples/etsy_login_browse.rb
|
82
83
|
- lib/ruby-jmeter.rb
|
83
84
|
- lib/ruby-jmeter/DSL.md
|
@@ -245,7 +246,4 @@ rubygems_version: 1.8.23
|
|
245
246
|
signing_key:
|
246
247
|
specification_version: 3
|
247
248
|
summary: This is a Ruby based DSL for writing JMeter test plans
|
248
|
-
test_files:
|
249
|
-
- spec/dsl_spec.rb
|
250
|
-
- spec/spec_helper.rb
|
251
|
-
- spec/stub.rb
|
249
|
+
test_files: []
|