Sha256: d7da1656389eb749dd894a2e465520fd21c7bed8372ec58e39359a83b5d9eecb

Contents?: true

Size: 974 Bytes

Versions: 2

Compression:

Stored size: 974 Bytes

Contents

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

  class RandomVariable
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "RandomVariable" : (params[:name] || "RandomVariable")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="#{testname}" enabled="true">
          <stringProp name="maximumValue"/>
          <stringProp name="minimumValue">1</stringProp>
          <stringProp name="outputFormat"/>
          <boolProp name="perThread">false</boolProp>
          <stringProp name="randomSeed"/>
          <stringProp name="variableName"/>
        </RandomVariableConfig>
      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/random_variable.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/random_variable.rb