Sha256: a03205a3ad97e606cdc514c32ade54a25438c73528696d4e6f93ba78afa7485d

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

module JmeterPerf
  class DSL
    # DSL method synonymous with the JMeter Element RandomController
    # @see https://github.com/jlurena/jmeter_perf/wiki/1.-DSL-Documentation#randomcontroller
    # @param [Hash] params Parameters for the RandomController element (default: `{}`).
    # @yield block to attach to the RandomController element
    # @return [JmeterPerf::RandomController], a subclass of JmeterPerf::DSL that can be chained with other DSL methods.
    def random_controller(params = {}, &)
      node = JmeterPerf::RandomController.new(params)
      attach_node(node, &)
    end
  end

  class RandomController
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "RandomController" : (params[:name] || "RandomController")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <RandomController guiclass="RandomControlGui" testclass="RandomController" testname="#{testname}" enabled="true">
          <intProp name="InterleaveControl.style">1</intProp>
        </RandomController>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jmeter_perf-0.0.7 lib/jmeter_perf/dsl/random_controller.rb