Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMeter point-to-point sampler doesn't allow to provide dynamic values #3437

Open
asfimport opened this issue Sep 24, 2014 · 4 comments
Open

Comments

@asfimport
Copy link
Collaborator

juanma.cvega (Bug 57015):
The point-to-point sampler in JMeter for request-reply messages doesn't allow to provide parameterized values. All configuration values must be hard coded into the sampler, so any attempt to create dynamic values for the jms broker host for example don't work.

OS: All

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Hello,
Can you provide a sample Test plan , describe the expected behaviour vs what you get ?

If possible make Test plan for ActiveMQ.
Thanks

@asfimport
Copy link
Collaborator Author

juanma.cvega (migrated from Bugzilla):
The test plan provides two user defined variables that are used to specify the broker host and port. Then, inside a thread group, the test tries to change the value of the JMS_BROKER_HOST variable in a bean sampler, providing another string, before running the jms point-to-point sampler. When running the test, it's easy to see in the View Results Tree how an exception is thrown saying the sampler cannot reach the broker in the specified host, that is the one defined in the user defined variables, not in the bean sampler. It can also be checked in the Debug sampler provided that the new value is stored in the user variable.

Created attachment Test Plan.jmx: Test plan example

Test Plan.jmx
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.6" jmeter="2.11 r1554548">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments">
          <elementProp name="JMS_BROKER_HOST" elementType="Argument">
            <stringProp name="Argument.name">JMS_BROKER_HOST</stringProp>
            <stringProp name="Argument.value">brokerHost</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
          </elementProp>
          <elementProp name="JMS_BROKER_PORT" elementType="Argument">
            <stringProp name="Argument.name">JMS_BROKER_PORT</stringProp>
            <stringProp name="Argument.value">61616</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
          </elementProp>
        </collectionProp>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1412327165000</longProp>
        <longProp name="ThreadGroup.end_time">1412327165000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="Change broker host" enabled="true">
          <stringProp name="BeanShellSampler.query">vars.put(&quot;JMS_BROKER_HOST&quot;,&quot;anotherBrokerHost&quot;);</stringProp>
          <stringProp name="BeanShellSampler.filename"></stringProp>
          <stringProp name="BeanShellSampler.parameters"></stringProp>
          <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp>
        </BeanShellSampler>
        <hashTree/>
        <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
          <boolProp name="displayJMeterProperties">false</boolProp>
          <boolProp name="displayJMeterVariables">true</boolProp>
          <boolProp name="displaySystemProperties">false</boolProp>
        </DebugSampler>
        <hashTree/>
        <JMSSampler guiclass="JMSSamplerGui" testclass="JMSSampler" testname="JMS Point-to-Point" enabled="true">
          <stringProp name="JMSSampler.queueconnectionfactory">ConnectionFactory</stringProp>
          <stringProp name="JMSSampler.SendQueue">Q.REQ</stringProp>
          <stringProp name="JMSSampler.ReceiveQueue">Q.RPL</stringProp>
          <boolProp name="JMSSampler.isFireAndForget">true</boolProp>
          <boolProp name="JMSSampler.isNonPersistent">true</boolProp>
          <boolProp name="JMSSampler.useReqMsgIdAsCorrelId">true</boolProp>
          <stringProp name="JMSSampler.timeout"></stringProp>
          <stringProp name="HTTPSamper.xml_data"></stringProp>
          <stringProp name="JMSSampler.initialContextFactory">org.apache.activemq.jndi.ActiveMQInitialContextFactory</stringProp>
          <stringProp name="JMSSampler.contextProviderUrl">tcp://${JMS_BROKER_HOST}:${JMS_BROKER_PORT}</stringProp>
          <elementProp name="JMSSampler.jndiProperties" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
            <collectionProp name="Arguments.arguments">
              <elementProp name="queue.Q.REQ" elementType="Argument">
                <stringProp name="Argument.name">queue.Q.REQ</stringProp>
                <stringProp name="Argument.value">test.in</stringProp>
                <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
              <elementProp name="queue.Q.RPL" elementType="Argument">
                <stringProp name="Argument.name">queue.Q.RPL</stringProp>
                <stringProp name="Argument.value">jmeter.in</stringProp>
                <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
            </collectionProp>
          </elementProp>
          <elementProp name="arguments" elementType="JMSProperties">
            <collectionProp name="JMSProperties.properties"/>
          </elementProp>
        </JMSSampler>
        <hashTree/>
      </hashTree>
      <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
          </value>
        </objProp>
        <stringProp name="filename"></stringProp>
      </ResultCollector>
      <hashTree/>
      <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
          </value>
        </objProp>
        <stringProp name="filename"></stringProp>
      </ResultCollector>
      <hashTree/>
    </hashTree>
  </hashTree>
</jmeterTestPlan>

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
The provider URL is resolved at configuration time, i.e. before the thread runs the BeanShell Pre-processor.

It is possible to change variables using a Config test element such as the User Defined Variables element.

@asfimport
Copy link
Collaborator Author

juanma.cvega (migrated from Bugzilla):
Yes, that way it works. But other elements that provide dynamic ways of changing the value don't work. I've tried using Random Variable element, CSV Data Set Config or Bean Shell sampler and those don't work.
The reason for this requirement is to be able to test clustered configurations. Without it, I'm forced to duplicate the test plan, providing a value for each of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant