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.
Files changed (123) hide show
  1. data/examples/basic_header.rb +5 -1
  2. data/examples/basic_user_defined_variables.rb +10 -0
  3. data/lib/ruby-jmeter/dsl/access_log_sampler.rb +3 -3
  4. data/lib/ruby-jmeter/dsl/aggregate_graph.rb +3 -3
  5. data/lib/ruby-jmeter/dsl/aggregate_report.rb +3 -3
  6. data/lib/ruby-jmeter/dsl/ajp13_sampler.rb +4 -4
  7. data/lib/ruby-jmeter/dsl/assertion_results.rb +3 -3
  8. data/lib/ruby-jmeter/dsl/beanshell_assertion.rb +3 -3
  9. data/lib/ruby-jmeter/dsl/beanshell_listener.rb +3 -3
  10. data/lib/ruby-jmeter/dsl/beanshell_postprocessor.rb +3 -3
  11. data/lib/ruby-jmeter/dsl/beanshell_preprocessor.rb +3 -3
  12. data/lib/ruby-jmeter/dsl/beanshell_sampler.rb +3 -3
  13. data/lib/ruby-jmeter/dsl/beanshell_timer.rb +3 -3
  14. data/lib/ruby-jmeter/dsl/bsf_assertion.rb +3 -3
  15. data/lib/ruby-jmeter/dsl/bsf_listener.rb +3 -3
  16. data/lib/ruby-jmeter/dsl/bsf_postprocessor.rb +3 -3
  17. data/lib/ruby-jmeter/dsl/bsf_preprocessor.rb +3 -3
  18. data/lib/ruby-jmeter/dsl/bsf_sampler.rb +3 -3
  19. data/lib/ruby-jmeter/dsl/bsf_timer.rb +3 -3
  20. data/lib/ruby-jmeter/dsl/compare_assertion.rb +3 -3
  21. data/lib/ruby-jmeter/dsl/comparison_assertion_visualizer.rb +3 -3
  22. data/lib/ruby-jmeter/dsl/constant_throughput_timer.rb +3 -3
  23. data/lib/ruby-jmeter/dsl/constant_timer.rb +3 -3
  24. data/lib/ruby-jmeter/dsl/counter.rb +3 -3
  25. data/lib/ruby-jmeter/dsl/cssjquery_extractor.rb +3 -3
  26. data/lib/ruby-jmeter/dsl/csv_data_set_config.rb +3 -3
  27. data/lib/ruby-jmeter/dsl/debug_postprocessor.rb +3 -3
  28. data/lib/ruby-jmeter/dsl/debug_sampler.rb +3 -3
  29. data/lib/ruby-jmeter/dsl/distribution_graphalpha.rb +3 -3
  30. data/lib/ruby-jmeter/dsl/duration_assertion.rb +3 -3
  31. data/lib/ruby-jmeter/dsl/foreach_controller.rb +3 -3
  32. data/lib/ruby-jmeter/dsl/ftp_request.rb +3 -3
  33. data/lib/ruby-jmeter/dsl/ftp_request_defaults.rb +3 -3
  34. data/lib/ruby-jmeter/dsl/gaussian_random_timer.rb +3 -3
  35. data/lib/ruby-jmeter/dsl/generate_summary_results.rb +3 -3
  36. data/lib/ruby-jmeter/dsl/graph_results.rb +3 -3
  37. data/lib/ruby-jmeter/dsl/html_assertion.rb +3 -3
  38. data/lib/ruby-jmeter/dsl/html_link_parser.rb +3 -3
  39. data/lib/ruby-jmeter/dsl/html_parameter_mask.rb +3 -3
  40. data/lib/ruby-jmeter/dsl/http_authorization_manager.rb +3 -3
  41. data/lib/ruby-jmeter/dsl/http_cache_manager.rb +3 -3
  42. data/lib/ruby-jmeter/dsl/http_cookie_manager.rb +3 -3
  43. data/lib/ruby-jmeter/dsl/http_header_manager.rb +3 -3
  44. data/lib/ruby-jmeter/dsl/http_request.rb +4 -4
  45. data/lib/ruby-jmeter/dsl/http_request_defaults.rb +4 -4
  46. data/lib/ruby-jmeter/dsl/http_url_rewriting_modifier.rb +3 -3
  47. data/lib/ruby-jmeter/dsl/if_controller.rb +3 -3
  48. data/lib/ruby-jmeter/dsl/include_controller.rb +3 -3
  49. data/lib/ruby-jmeter/dsl/java_request.rb +3 -3
  50. data/lib/ruby-jmeter/dsl/java_request_defaults.rb +3 -3
  51. data/lib/ruby-jmeter/dsl/jdbc_connection_configuration.rb +3 -3
  52. data/lib/ruby-jmeter/dsl/jdbc_postprocessor.rb +3 -3
  53. data/lib/ruby-jmeter/dsl/jdbc_preprocessor.rb +3 -3
  54. data/lib/ruby-jmeter/dsl/jdbc_request.rb +3 -3
  55. data/lib/ruby-jmeter/dsl/jms_pointtopoint.rb +5 -5
  56. data/lib/ruby-jmeter/dsl/jms_publisher.rb +4 -4
  57. data/lib/ruby-jmeter/dsl/jms_subscriber.rb +3 -3
  58. data/lib/ruby-jmeter/dsl/jsr223_assertion.rb +3 -3
  59. data/lib/ruby-jmeter/dsl/jsr223_listener.rb +3 -3
  60. data/lib/ruby-jmeter/dsl/jsr223_postprocessor.rb +3 -3
  61. data/lib/ruby-jmeter/dsl/jsr223_preprocessor.rb +3 -3
  62. data/lib/ruby-jmeter/dsl/jsr223_sampler.rb +3 -3
  63. data/lib/ruby-jmeter/dsl/jsr223_timer.rb +3 -3
  64. data/lib/ruby-jmeter/dsl/junit_request.rb +3 -3
  65. data/lib/ruby-jmeter/dsl/keystore_configuration.rb +3 -3
  66. data/lib/ruby-jmeter/dsl/ldap_extended_request.rb +3 -3
  67. data/lib/ruby-jmeter/dsl/ldap_extended_request_defaults.rb +3 -3
  68. data/lib/ruby-jmeter/dsl/ldap_request.rb +4 -4
  69. data/lib/ruby-jmeter/dsl/ldap_request_defaults.rb +4 -4
  70. data/lib/ruby-jmeter/dsl/login_config_element.rb +3 -3
  71. data/lib/ruby-jmeter/dsl/loop_controller.rb +3 -3
  72. data/lib/ruby-jmeter/dsl/mail_reader_sampler.rb +3 -3
  73. data/lib/ruby-jmeter/dsl/mailer_visualizer.rb +3 -3
  74. data/lib/ruby-jmeter/dsl/md5hex_assertion.rb +3 -3
  75. data/lib/ruby-jmeter/dsl/module_controller.rb +3 -3
  76. data/lib/ruby-jmeter/dsl/monitor_results.rb +3 -3
  77. data/lib/ruby-jmeter/dsl/once_only_controller.rb +3 -3
  78. data/lib/ruby-jmeter/dsl/os_process_sampler.rb +5 -5
  79. data/lib/ruby-jmeter/dsl/poisson_random_timer.rb +3 -3
  80. data/lib/ruby-jmeter/dsl/random_controller.rb +3 -3
  81. data/lib/ruby-jmeter/dsl/random_order_controller.rb +3 -3
  82. data/lib/ruby-jmeter/dsl/random_variable.rb +3 -3
  83. data/lib/ruby-jmeter/dsl/recording_controller.rb +3 -3
  84. data/lib/ruby-jmeter/dsl/regex_user_parameters.rb +3 -3
  85. data/lib/ruby-jmeter/dsl/regular_expression_extractor.rb +3 -3
  86. data/lib/ruby-jmeter/dsl/response_assertion.rb +3 -3
  87. data/lib/ruby-jmeter/dsl/response_time_graph.rb +3 -3
  88. data/lib/ruby-jmeter/dsl/result_status_action_handler.rb +3 -3
  89. data/lib/ruby-jmeter/dsl/runtime_controller.rb +3 -3
  90. data/lib/ruby-jmeter/dsl/save_responses_to_a_file.rb +3 -3
  91. data/lib/ruby-jmeter/dsl/simple_config_element.rb +3 -3
  92. data/lib/ruby-jmeter/dsl/simple_controller.rb +3 -3
  93. data/lib/ruby-jmeter/dsl/simple_data_writer.rb +3 -3
  94. data/lib/ruby-jmeter/dsl/smime_assertion.rb +3 -3
  95. data/lib/ruby-jmeter/dsl/smtp_sampler.rb +3 -3
  96. data/lib/ruby-jmeter/dsl/soapxmlrpc_request.rb +3 -3
  97. data/lib/ruby-jmeter/dsl/spline_visualizer.rb +3 -3
  98. data/lib/ruby-jmeter/dsl/summary_report.rb +3 -3
  99. data/lib/ruby-jmeter/dsl/switch_controller.rb +3 -3
  100. data/lib/ruby-jmeter/dsl/synchronizing_timer.rb +3 -3
  101. data/lib/ruby-jmeter/dsl/tcp_sampler.rb +3 -3
  102. data/lib/ruby-jmeter/dsl/tcp_sampler_config.rb +3 -3
  103. data/lib/ruby-jmeter/dsl/test_action.rb +3 -3
  104. data/lib/ruby-jmeter/dsl/test_plan.rb +4 -4
  105. data/lib/ruby-jmeter/dsl/thread_group.rb +4 -4
  106. data/lib/ruby-jmeter/dsl/throughput_controller.rb +3 -3
  107. data/lib/ruby-jmeter/dsl/transaction_controller.rb +3 -3
  108. data/lib/ruby-jmeter/dsl/uniform_random_timer.rb +3 -3
  109. data/lib/ruby-jmeter/dsl/user_defined_variables.rb +3 -3
  110. data/lib/ruby-jmeter/dsl/user_parameters.rb +3 -3
  111. data/lib/ruby-jmeter/dsl/view_results_in_table.rb +3 -3
  112. data/lib/ruby-jmeter/dsl/view_results_tree.rb +3 -3
  113. data/lib/ruby-jmeter/dsl/while_controller.rb +3 -3
  114. data/lib/ruby-jmeter/dsl/xml_assertion.rb +3 -3
  115. data/lib/ruby-jmeter/dsl/xml_schema_assertion.rb +3 -3
  116. data/lib/ruby-jmeter/dsl/xpath_assertion.rb +3 -3
  117. data/lib/ruby-jmeter/dsl/xpath_extractor.rb +3 -3
  118. data/lib/ruby-jmeter/dsl.rb +6 -2
  119. data/lib/ruby-jmeter/helpers/helper.rb +20 -3
  120. data/lib/ruby-jmeter/idl.rb +3 -3
  121. data/lib/ruby-jmeter/version.rb +1 -1
  122. data/spec/dsl_spec.rb +22 -0
  123. metadata +4 -6
@@ -2,7 +2,11 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  require 'ruby-jmeter'
3
3
 
4
4
  test do
5
- header name: 'Accept', value: '*'
5
+ # header with multiple values
6
+ header [
7
+ { name: 'Accept', value: '*' },
8
+ { name: 'User-Agent', value: 'Test' }
9
+ ]
6
10
 
7
11
  with_user_agent :iphone
8
12
 
@@ -0,0 +1,10 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'ruby-jmeter'
3
+
4
+ test do
5
+ # user defined with multiple values
6
+ variables [
7
+ { name: 'email', value: 'support@flood.io' },
8
+ { name: 'password', value: 'password' }
9
+ ]
10
+ end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'AccessLogSampler'
14
+ testname = params.kind_of?(Array) ? 'AccessLogSampler' : (params[:name] || 'AccessLogSampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <AccessLogSampler guiclass="TestBeanGUI" testclass="AccessLogSampler" testname="#{params[:name]}" enabled="true">
16
+ <AccessLogSampler guiclass="TestBeanGUI" testclass="AccessLogSampler" testname="#{testname}" enabled="true">
17
17
  <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
18
18
  <collectionProp name="Arguments.arguments"/>
19
19
  </elementProp>
@@ -25,7 +25,7 @@ module RubyJmeter
25
25
  </AccessLogSampler>)
26
26
  EOS
27
27
  update params
28
- update_at_xpath params if params[:update_at_xpath]
28
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
29
29
  end
30
30
  end
31
31
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'AggregateGraph'
14
+ testname = params.kind_of?(Array) ? 'AggregateGraph' : (params[:name] || 'AggregateGraph')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="StatGraphVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="StatGraphVisualizer" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'AggregateReport'
14
+ testname = params.kind_of?(Array) ? 'AggregateReport' : (params[:name] || 'AggregateReport')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,10 +11,10 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'Ajp13Sampler'
14
+ testname = params.kind_of?(Array) ? 'Ajp13Sampler' : (params[:name] || 'Ajp13Sampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <AjpSampler guiclass="AjpSamplerGui" testclass="AjpSampler" testname="#{params[:name]}" enabled="true">
17
- <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="#{params[:name]}" enabled="true">
16
+ <AjpSampler guiclass="AjpSamplerGui" testclass="AjpSampler" testname="#{testname}" enabled="true">
17
+ <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="#{testname}" enabled="true">
18
18
  <collectionProp name="Arguments.arguments"/>
19
19
  </elementProp>
20
20
  <stringProp name="HTTPSampler.domain"/>
@@ -34,7 +34,7 @@ module RubyJmeter
34
34
  </AjpSampler>)
35
35
  EOS
36
36
  update params
37
- update_at_xpath params if params[:update_at_xpath]
37
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
38
38
  end
39
39
  end
40
40
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'AssertionResults'
14
+ testname = params.kind_of?(Array) ? 'AssertionResults' : (params[:name] || 'AssertionResults')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="AssertionVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="AssertionVisualizer" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BeanshellAssertion'
14
+ testname = params.kind_of?(Array) ? 'BeanshellAssertion' : (params[:name] || 'BeanshellAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="#{params[:name]}" enabled="true">
16
+ <BeanShellAssertion guiclass="BeanShellAssertionGui" testclass="BeanShellAssertion" testname="#{testname}" enabled="true">
17
17
  <stringProp name="BeanShellAssertion.query"/>
18
18
  <stringProp name="BeanShellAssertion.filename"/>
19
19
  <stringProp name="BeanShellAssertion.parameters"/>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BeanShellAssertion>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BeanshellListener'
14
+ testname = params.kind_of?(Array) ? 'BeanshellListener' : (params[:name] || 'BeanshellListener')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BeanShellListener guiclass="TestBeanGUI" testclass="BeanShellListener" testname="#{params[:name]}" enabled="true">
16
+ <BeanShellListener guiclass="TestBeanGUI" testclass="BeanShellListener" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <boolProp name="resetInterpreter">false</boolProp>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BeanShellListener>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BeanshellPostprocessor'
14
+ testname = params.kind_of?(Array) ? 'BeanshellPostprocessor' : (params[:name] || 'BeanshellPostprocessor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="#{params[:name]}" enabled="true">
16
+ <BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <boolProp name="resetInterpreter">false</boolProp>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BeanShellPostProcessor>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BeanshellPreprocessor'
14
+ testname = params.kind_of?(Array) ? 'BeanshellPreprocessor' : (params[:name] || 'BeanshellPreprocessor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="#{params[:name]}" enabled="true">
16
+ <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <boolProp name="resetInterpreter">false</boolProp>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BeanShellPreProcessor>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BeanshellSampler'
14
+ testname = params.kind_of?(Array) ? 'BeanshellSampler' : (params[:name] || 'BeanshellSampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="#{params[:name]}" enabled="true">
16
+ <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="BeanShellSampler.query"/>
18
18
  <stringProp name="BeanShellSampler.filename"/>
19
19
  <stringProp name="BeanShellSampler.parameters"/>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BeanShellSampler>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BeanshellTimer'
14
+ testname = params.kind_of?(Array) ? 'BeanshellTimer' : (params[:name] || 'BeanshellTimer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BeanShellTimer guiclass="TestBeanGUI" testclass="BeanShellTimer" testname="#{params[:name]}" enabled="true">
16
+ <BeanShellTimer guiclass="TestBeanGUI" testclass="BeanShellTimer" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <boolProp name="resetInterpreter">false</boolProp>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BeanShellTimer>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BsfAssertion'
14
+ testname = params.kind_of?(Array) ? 'BsfAssertion' : (params[:name] || 'BsfAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BSFAssertion guiclass="TestBeanGUI" testclass="BSFAssertion" testname="#{params[:name]}" enabled="true">
16
+ <BSFAssertion guiclass="TestBeanGUI" testclass="BSFAssertion" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <stringProp name="script"/>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BSFAssertion>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BsfListener'
14
+ testname = params.kind_of?(Array) ? 'BsfListener' : (params[:name] || 'BsfListener')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BSFListener guiclass="TestBeanGUI" testclass="BSFListener" testname="#{params[:name]}" enabled="true">
16
+ <BSFListener guiclass="TestBeanGUI" testclass="BSFListener" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <stringProp name="script"/>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BSFListener>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BsfPostprocessor'
14
+ testname = params.kind_of?(Array) ? 'BsfPostprocessor' : (params[:name] || 'BsfPostprocessor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BSFPostProcessor guiclass="TestBeanGUI" testclass="BSFPostProcessor" testname="#{params[:name]}" enabled="true">
16
+ <BSFPostProcessor guiclass="TestBeanGUI" testclass="BSFPostProcessor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <stringProp name="script"/>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BSFPostProcessor>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BsfPreprocessor'
14
+ testname = params.kind_of?(Array) ? 'BsfPreprocessor' : (params[:name] || 'BsfPreprocessor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BSFPreProcessor guiclass="TestBeanGUI" testclass="BSFPreProcessor" testname="#{params[:name]}" enabled="true">
16
+ <BSFPreProcessor guiclass="TestBeanGUI" testclass="BSFPreProcessor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <stringProp name="script"/>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BSFPreProcessor>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BsfSampler'
14
+ testname = params.kind_of?(Array) ? 'BsfSampler' : (params[:name] || 'BsfSampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BSFSampler guiclass="TestBeanGUI" testclass="BSFSampler" testname="#{params[:name]}" enabled="true">
16
+ <BSFSampler guiclass="TestBeanGUI" testclass="BSFSampler" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <stringProp name="script"/>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BSFSampler>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'BsfTimer'
14
+ testname = params.kind_of?(Array) ? 'BsfTimer' : (params[:name] || 'BsfTimer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <BSFTimer guiclass="TestBeanGUI" testclass="BSFTimer" testname="#{params[:name]}" enabled="true">
16
+ <BSFTimer guiclass="TestBeanGUI" testclass="BSFTimer" testname="#{testname}" enabled="true">
17
17
  <stringProp name="filename"/>
18
18
  <stringProp name="parameters"/>
19
19
  <stringProp name="script"/>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </BSFTimer>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,16 +11,16 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'CompareAssertion'
14
+ testname = params.kind_of?(Array) ? 'CompareAssertion' : (params[:name] || 'CompareAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <CompareAssertion guiclass="TestBeanGUI" testclass="CompareAssertion" testname="#{params[:name]}" enabled="true">
16
+ <CompareAssertion guiclass="TestBeanGUI" testclass="CompareAssertion" testname="#{testname}" enabled="true">
17
17
  <boolProp name="compareContent">true</boolProp>
18
18
  <longProp name="compareTime">-1</longProp>
19
19
  <collectionProp name="stringsToSkip"/>
20
20
  </CompareAssertion>)
21
21
  EOS
22
22
  update params
23
- update_at_xpath params if params[:update_at_xpath]
23
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
24
24
  end
25
25
  end
26
26
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ComparisonAssertionVisualizer'
14
+ testname = params.kind_of?(Array) ? 'ComparisonAssertionVisualizer' : (params[:name] || 'ComparisonAssertionVisualizer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="ComparisonVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="ComparisonVisualizer" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ConstantThroughputTimer'
14
+ testname = params.kind_of?(Array) ? 'ConstantThroughputTimer' : (params[:name] || 'ConstantThroughputTimer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="#{params[:name]}" enabled="true">
16
+ <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="#{testname}" enabled="true">
17
17
  <stringProp name="calcMode">this thread only</stringProp>
18
18
  <doubleProp>
19
19
  <name>throughput</name>
@@ -23,7 +23,7 @@ module RubyJmeter
23
23
  </ConstantThroughputTimer>)
24
24
  EOS
25
25
  update params
26
- update_at_xpath params if params[:update_at_xpath]
26
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
27
27
  end
28
28
  end
29
29
 
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'ConstantTimer'
14
+ testname = params.kind_of?(Array) ? 'ConstantTimer' : (params[:name] || 'ConstantTimer')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="#{params[:name]}" enabled="true">
16
+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="#{testname}" enabled="true">
17
17
  <stringProp name="ConstantTimer.delay">300</stringProp>
18
18
  </ConstantTimer>)
19
19
  EOS
20
20
  update params
21
- update_at_xpath params if params[:update_at_xpath]
21
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
22
22
  end
23
23
  end
24
24
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'Counter'
14
+ testname = params.kind_of?(Array) ? 'Counter' : (params[:name] || 'Counter')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="#{params[:name]}" enabled="true">
16
+ <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="#{testname}" enabled="true">
17
17
  <stringProp name="CounterConfig.start"/>
18
18
  <stringProp name="CounterConfig.end"/>
19
19
  <stringProp name="CounterConfig.incr"/>
@@ -24,7 +24,7 @@ module RubyJmeter
24
24
  </CounterConfig>)
25
25
  EOS
26
26
  update params
27
- update_at_xpath params if params[:update_at_xpath]
27
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
28
28
  end
29
29
  end
30
30
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'CssjqueryExtractor'
14
+ testname = params.kind_of?(Array) ? 'CssjqueryExtractor' : (params[:name] || 'CssjqueryExtractor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <HtmlExtractor guiclass="HtmlExtractorGui" testclass="HtmlExtractor" testname="#{params[:name]}" enabled="true">
16
+ <HtmlExtractor guiclass="HtmlExtractorGui" testclass="HtmlExtractor" testname="#{testname}" enabled="true">
17
17
  <stringProp name="HtmlExtractor.refname"/>
18
18
  <stringProp name="HtmlExtractor.expr"/>
19
19
  <stringProp name="HtmlExtractor.attribute"/>
@@ -23,7 +23,7 @@ module RubyJmeter
23
23
  </HtmlExtractor>)
24
24
  EOS
25
25
  update params
26
- update_at_xpath params if params[:update_at_xpath]
26
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
27
27
  end
28
28
  end
29
29
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'CsvDataSetConfig'
14
+ testname = params.kind_of?(Array) ? 'CsvDataSetConfig' : (params[:name] || 'CsvDataSetConfig')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="#{params[:name]}" enabled="true">
16
+ <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="#{testname}" enabled="true">
17
17
  <stringProp name="delimiter">,</stringProp>
18
18
  <stringProp name="fileEncoding"/>
19
19
  <stringProp name="filename"/>
@@ -25,7 +25,7 @@ module RubyJmeter
25
25
  </CSVDataSet>)
26
26
  EOS
27
27
  update params
28
- update_at_xpath params if params[:update_at_xpath]
28
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
29
29
  end
30
30
  end
31
31
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'DebugPostprocessor'
14
+ testname = params.kind_of?(Array) ? 'DebugPostprocessor' : (params[:name] || 'DebugPostprocessor')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <DebugPostProcessor guiclass="TestBeanGUI" testclass="DebugPostProcessor" testname="#{params[:name]}" enabled="true">
16
+ <DebugPostProcessor guiclass="TestBeanGUI" testclass="DebugPostProcessor" testname="#{testname}" enabled="true">
17
17
  <boolProp name="displayJMeterProperties">false</boolProp>
18
18
  <boolProp name="displayJMeterVariables">true</boolProp>
19
19
  <boolProp name="displaySamplerProperties">true</boolProp>
@@ -21,7 +21,7 @@ module RubyJmeter
21
21
  </DebugPostProcessor>)
22
22
  EOS
23
23
  update params
24
- update_at_xpath params if params[:update_at_xpath]
24
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
25
25
  end
26
26
  end
27
27
 
@@ -11,16 +11,16 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'DebugSampler'
14
+ testname = params.kind_of?(Array) ? 'DebugSampler' : (params[:name] || 'DebugSampler')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="#{params[:name]}" enabled="true">
16
+ <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="#{testname}" enabled="true">
17
17
  <boolProp name="displayJMeterProperties">false</boolProp>
18
18
  <boolProp name="displayJMeterVariables">true</boolProp>
19
19
  <boolProp name="displaySystemProperties">false</boolProp>
20
20
  </DebugSampler>)
21
21
  EOS
22
22
  update params
23
- update_at_xpath params if params[:update_at_xpath]
23
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
24
24
  end
25
25
  end
26
26
 
@@ -11,9 +11,9 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'DistributionGraphalpha'
14
+ testname = params.kind_of?(Array) ? 'DistributionGraphalpha' : (params[:name] || 'DistributionGraphalpha')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ResultCollector guiclass="DistributionGraphVisualizer" testclass="ResultCollector" testname="#{params[:name]}" enabled="true">
16
+ <ResultCollector guiclass="DistributionGraphVisualizer" testclass="ResultCollector" testname="#{testname}" enabled="true">
17
17
  <boolProp name="ResultCollector.error_logging">false</boolProp>
18
18
  <objProp>
19
19
  <name>saveConfig</name>
@@ -48,7 +48,7 @@ module RubyJmeter
48
48
  </ResultCollector>)
49
49
  EOS
50
50
  update params
51
- update_at_xpath params if params[:update_at_xpath]
51
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
52
52
  end
53
53
  end
54
54
 
@@ -11,14 +11,14 @@ module RubyJmeter
11
11
  include Helper
12
12
 
13
13
  def initialize(params={})
14
- params[:name] ||= 'DurationAssertion'
14
+ testname = params.kind_of?(Array) ? 'DurationAssertion' : (params[:name] || 'DurationAssertion')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <DurationAssertion guiclass="DurationAssertionGui" testclass="DurationAssertion" testname="#{params[:name]}" enabled="true">
16
+ <DurationAssertion guiclass="DurationAssertionGui" testclass="DurationAssertion" testname="#{testname}" enabled="true">
17
17
  <stringProp name="DurationAssertion.duration"/>
18
18
  </DurationAssertion>)
19
19
  EOS
20
20
  update params
21
- update_at_xpath params if params[:update_at_xpath]
21
+ update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
22
22
  end
23
23
  end
24
24