Sha256: eedfabc40ca44028a75232df305ad0b54ddeeeeb1c2f66f6774d4e22e17f879a

Contents?: true

Size: 975 Bytes

Versions: 2

Compression:

Stored size: 975 Bytes

Contents

module JmeterPerf
  class DSL
    def user_parameters(params = {}, &)
      node = JmeterPerf::UserParameters.new(params)
      attach_node(node, &)
    end
  end

  class UserParameters
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "UserParameters" : (params[:name] || "UserParameters")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="#{testname}" enabled="true">
          <collectionProp name="UserParameters.names"/>
          <collectionProp name="UserParameters.thread_values">
            <collectionProp name="1"/>
            <collectionProp name="1"/>
          </collectionProp>
          <boolProp name="UserParameters.per_iteration">false</boolProp>
        </UserParameters>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jmeter_perf-0.0.6 lib/jmeter_perf/dsl/user_parameters.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/user_parameters.rb