Sha256: 8c06493b9a377bbf07a3e130e02beeb0bba04ab2fb71c7557d72b20741cfe8ac

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

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

  class IncludeController
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "IncludeController" : (params[:name] || "IncludeController")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <IncludeController guiclass="IncludeControllerGui" testclass="IncludeController" testname="#{testname}" enabled="true">
          <stringProp name="IncludeController.includepath"/>
        </IncludeController>
      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/include_controller.rb