ruby-jmeter 2.11.6 → 2.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10676650fd31cdb67abc4b35df98b96095c811a4
4
- data.tar.gz: 20ac434469c62af4f9ed6e9ad860bdeeb9b67f61
3
+ metadata.gz: 292b0362da06efe27eef6c870a97d1d6765f9ee9
4
+ data.tar.gz: e5cc75c8bae12aefbbc43472a09d74ab7a7ee09d
5
5
  SHA512:
6
- metadata.gz: 69ac56b3fa3ecca4e3efccc08e7273f08d2072327c91864425bd674a75e106a985c0f7d1faf8ab491117764669e8d661fa8290538fa4e3b2d1ce8ce4264845a9
7
- data.tar.gz: 2e07aa6cc60feb4b693d12039dd2843ef5b57b51c7e499279d7f4a82cb09e51dda592fb1187618cc0c21097528192e268a246192f1072ee6ac30e0c641874cd5
6
+ metadata.gz: d46aabc1687ceea00fffb3d056027a94e668412f716987c39dc1f4ed59f3d0140b61358dbb82056c91af4b21936792aa6bc86aa3e2c3445892ff3228e41d14e3
7
+ data.tar.gz: 181e7695085cc948f84dfdc3d6f2b2ba9775bb2d1dd58ae4d58b53b1c59fab0327f7f27748d3ad8bf24bcf54061251f3b22b7caba136250dc604468543e31471
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/flood-io/ruby-jmeter.png)](https://travis-ci.org/flood-io/ruby-jmeter)
4
4
  [![Code Climate](https://codeclimate.com/github/flood-io/ruby-jmeter.png)](https://codeclimate.com/github/flood-io/ruby-jmeter)
5
+ [![Gem Version](https://badge.fury.io/rb/ruby-jmeter.svg)](http://badge.fury.io/rb/ruby-jmeter)
5
6
 
6
7
  Tired of using the JMeter GUI or looking at hairy XML files?
7
8
 
@@ -256,12 +257,12 @@ This method makes a single request. The fill_in parameter lets you specify key/v
256
257
  ### POST JSON
257
258
 
258
259
  ```ruby
259
- header [
260
+ header [
260
261
  { name: 'Content-Type', value: 'application/json' }
261
- ]
262
-
262
+ ]
263
+
263
264
  person = { name: "Tom" }
264
-
265
+
265
266
  post name: 'Create Person',
266
267
  url: "https://example.com/people.json",
267
268
  raw_body: person.to_json do
@@ -254,6 +254,20 @@ module RubyJmeter
254
254
  ##
255
255
  # Other Elements
256
256
 
257
+ def module_controller(params, &block)
258
+ node = RubyJmeter::ModuleController.new(params)
259
+
260
+ node_path = params.kind_of?(Array) ? [] : (params[:node_path] || [])
261
+ node_path.each_with_index do |node_name, index|
262
+ node.doc.at_xpath('//collectionProp') <<
263
+ Nokogiri::XML(<<-EOS.strip_heredoc).children
264
+ <stringProp name="node_#{index}">#{node_name}</stringProp>
265
+ EOS
266
+ end
267
+
268
+ attach_node(node, &block)
269
+ end
270
+
257
271
  def user_parameters(params, &block)
258
272
  if params.is_a?(Hash)
259
273
  params['Argument.name'] = params[:name]
@@ -13,7 +13,9 @@ module RubyJmeter
13
13
  def initialize(params={})
14
14
  testname = params.kind_of?(Array) ? 'ModuleController' : (params[:name] || 'ModuleController')
15
15
  @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
16
- <ModuleController guiclass="ModuleControllerGui" testclass="ModuleController" testname="#{testname}" enabled="true"/>)
16
+ <ModuleController guiclass="ModuleControllerGui" testclass="ModuleController" testname="#{testname}" enabled="true">
17
+ <collectionProp name="ModuleController.node_path"/>
18
+ </ModuleController>)
17
19
  EOS
18
20
  update params
19
21
  update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
@@ -279,7 +279,9 @@
279
279
  <stringProp name="LoopController.loops">1</stringProp>
280
280
  </LoopController>
281
281
  <hashTree/>
282
- <ModuleController guiclass="ModuleControllerGui" testclass="ModuleController" testname="Module Controller" enabled="true"/>
282
+ <ModuleController guiclass="ModuleControllerGui" testclass="ModuleController" testname="Module Controller" enabled="true">
283
+ <collectionProp name="ModuleController.node_path" />
284
+ </ModuleController>
283
285
  <hashTree/>
284
286
  <OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Once Only Controller" enabled="true"/>
285
287
  <hashTree/>
@@ -1,3 +1,3 @@
1
1
  module RubyJmeter
2
- VERSION = "2.11.6"
2
+ VERSION = "2.11.7"
3
3
  end
@@ -517,7 +517,7 @@ describe "DSL" do
517
517
  let(:fragment) { doc.search("//IfController").first }
518
518
 
519
519
  it 'should match on exists' do
520
- fragment.search(".//stringProp[@name='IfController.condition']").text.should == "'${apple}'.length > 0"
520
+ fragment.search(".//stringProp[@name='IfController.condition']").text.should == '"${apple}" != "\${apple}"'
521
521
  end
522
522
  end
523
523
 
@@ -813,4 +813,35 @@ describe "DSL" do
813
813
 
814
814
  end
815
815
 
816
+ describe 'module controllers' do
817
+ let(:doc) do
818
+ test name: 'tests' do
819
+ threads 1, name: 'threads' do
820
+ Simple name: 'controller_to_call'
821
+ end
822
+ threads 1 do
823
+ module_controller name: 'modules', node_path: [
824
+ 'WorkBench',
825
+ 'tests',
826
+ 'threads',
827
+ 'controller_to_call'
828
+ ]
829
+ end
830
+ end.to_doc
831
+ end
832
+
833
+ let(:simple_controller) { doc.search("//GenericController").first }
834
+ let(:test_module) { doc.search("//ModuleController").first }
835
+ let(:nodes) { test_module.search(".//stringProp") }
836
+
837
+
838
+ it 'should have a node path' do
839
+ nodes.length.should == 4
840
+ nodes[0].text.should == 'WorkBench'
841
+ nodes[1].text.should == 'tests'
842
+ nodes[2].text.should == 'threads'
843
+ nodes[3].text.should == 'controller_to_call'
844
+ end
845
+ end
846
+
816
847
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-jmeter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.6
4
+ version: 2.11.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Koopmans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-01 00:00:00.000000000 Z
11
+ date: 2014-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client