jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eddie O'Sullivan <...@qad.com>
Subject Re: Variables - reassigning values to existing variables
Date Wed, 21 Jun 2006 09:44:05 GMT




If you use a beanshell sampler to update the variable and use a regular
expression extractor to extract the updated variable that will work for
you.
                                                                                       
                                                                                       
                                                                                       
 Eddie O'Sullivan                                                      (Embedded image 
 Application Performance                                                moved to file: 
 Group                                                                   pic01131.gif) 
                                                                                       
 QAD Ireland Ltd.                             eos@qad.com                              
 Hamilton House                               Tel:  +353 61 213616                     
 National Technological Park                                                           
 Limerick, Ireland                                                                     
 http://www.qad.com/                                                                   
                                                                                       
                                                                                       
 A Passion for Manufacturing                                                           
                                                                                       
                                                                                       
 This e-mail may contain QAD                                                           
 proprietary information and                                                           
    should be treated as                                                               
        confidential.                                                                  
                                                                                       





                                                                           
             Adam Bradley                                                  
             <adam_j_bradley@y                                             
             ahoo.com>                                                  To 
             Sent by: news             jmeter-user@jakarta.apache.org      
             <news@sea.gmane.o                                          cc 
             rg>                                                           
                                                                   Subject 
                                       Variables - reassigning values to   
             21/06/2006 06:03          existing variables                  
                                                                           
                                                                           
             Please respond to                                             
               "JMeter Users                                               
                   List"                                                   
             <jmeter-user@jaka                                             
              rta.apache.org>                                              
                                                                           
                                                                           




Hi,

I've currently trying to reassign a value to a variable and was
wondering if this is possible/recommended ?

My skeletal test case and an image are attached.

Thanks in advance!
Adam
<jmeterTestPlan version="1.1" properties="1.7">
  <hashTree>
    <TestPlan>
      <elementProp name="TestPlan.user_defined_variables"
elementType="org.apache.jmeter.config.Arguments">
        <stringProp
name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</stringProp>

        <stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>

        <collectionProp name="Arguments.arguments"/>
        <stringProp name="TestElement.name">User Defined
Variables</stringProp>
        <boolProp name="TestElement.enabled">true</boolProp>
      </elementProp>
      <stringProp
name="TestElement.gui_class">org.apache.jmeter.control.gui.TestPlanGui</stringProp>

      <stringProp name="TestPlan.user_define_classpath"></stringProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <stringProp
name="TestElement.test_class">org.apache.jmeter.testelement.TestPlan</stringProp>

      <stringProp name="TestElement.name">Sample test</stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestElement.enabled">true</boolProp>
      <stringProp name="TestPlan.comments"></stringProp>
    </TestPlan>
    <hashTree>
      <org.apache.jmeter.config.Arguments>
        <stringProp
name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</stringProp>

        <stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>

        <collectionProp name="Arguments.arguments">
          <elementProp name="testType"
elementType="org.apache.jmeter.config.Argument">
            <stringProp name="Argument.metadata">=</stringProp>
            <stringProp name="Argument.value">Case2</stringProp>
            <stringProp name="Argument.name">testType</stringProp>
          </elementProp>
        </collectionProp>
        <stringProp name="TestElement.name">testType set to
Case2</stringProp>
        <boolProp name="TestElement.enabled">true</boolProp>
      </org.apache.jmeter.config.Arguments>
      <hashTree/>
      <ThreadGroup>
        <longProp name="ThreadGroup.start_time">1150863714000</longProp>
        <stringProp
name="TestElement.test_class">org.apache.jmeter.threads.ThreadGroup</stringProp>

        <stringProp name="ThreadGroup.delay"></stringProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <boolProp name="TestElement.enabled">true</boolProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp
name="TestElement.gui_class">org.apache.jmeter.threads.gui.ThreadGroupGui</stringProp>

        <elementProp name="ThreadGroup.main_controller"
elementType="org.apache.jmeter.control.LoopController">
          <stringProp
name="TestElement.gui_class">org.apache.jmeter.control.gui.LoopControlPanel</stringProp>

          <stringProp name="LoopController.loops">1</stringProp>
          <stringProp
name="TestElement.test_class">org.apache.jmeter.control.LoopController</stringProp>

          <stringProp name="TestElement.name">Loop Controller</stringProp>
          <boolProp name="TestElement.enabled">true</boolProp>
          <boolProp name="LoopController.continue_forever">false</boolProp>
        </elementProp>
        <stringProp name="TestElement.name">Thread Group</stringProp>
        <longProp name="ThreadGroup.end_time">1150863714000</longProp>
        <stringProp
name="ThreadGroup.on_sample_error">continue</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
      </ThreadGroup>
      <hashTree>
        <IfController>
          <stringProp
name="IfController.condition">&apos;${testType}&apos;==&apos;Case1&apos;</stringProp>

          <stringProp
name="TestElement.gui_class">org.apache.jmeter.control.gui.IfControllerPanel</stringProp>

          <stringProp
name="TestElement.test_class">org.apache.jmeter.control.IfController</stringProp>

          <stringProp name="TestElement.name">Case1</stringProp>
          <boolProp name="TestElement.enabled">true</boolProp>
        </IfController>
        <hashTree>
          <OnceOnlyController>
            <stringProp
name="TestElement.gui_class">org.apache.jmeter.control.gui.OnceOnlyControllerGui</stringProp>

            <stringProp
name="TestElement.test_class">org.apache.jmeter.control.OnceOnlyController</stringProp>

            <stringProp name="TestElement.name">Finish</stringProp>
            <boolProp name="TestElement.enabled">true</boolProp>
          </OnceOnlyController>
          <hashTree/>
        </hashTree>
        <IfController>
          <stringProp
name="IfController.condition">&apos;${testType}&apos;==&apos;Case2&apos;</stringProp>

          <stringProp
name="TestElement.gui_class">org.apache.jmeter.control.gui.IfControllerPanel</stringProp>

          <stringProp
name="TestElement.test_class">org.apache.jmeter.control.IfController</stringProp>

          <stringProp name="TestElement.name">Case2</stringProp>
          <boolProp name="TestElement.enabled">true</boolProp>
        </IfController>
        <hashTree>
          <org.apache.jmeter.config.Arguments>
            <stringProp
name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</stringProp>

            <stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>

            <collectionProp name="Arguments.arguments">
              <elementProp name="URL"
elementType="org.apache.jmeter.config.Argument">
                <stringProp name="Argument.metadata">=</stringProp>
                <stringProp
name="Argument.value">http://www.novell.com</stringProp>
                <stringProp name="Argument.name">URL</stringProp>
              </elementProp>
            </collectionProp>
            <stringProp name="TestElement.name">URL set to
www.novell.com</stringProp>
            <boolProp name="TestElement.enabled">true</boolProp>
          </org.apache.jmeter.config.Arguments>
          <hashTree/>
          <HTTPSampler>
            <stringProp name="HTTPSampler.path"></stringProp>
            <stringProp
name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</stringProp>

            <stringProp name="HTTPSampler.method">GET</stringProp>
            <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
            <stringProp name="HTTPSampler.protocol"></stringProp>
            <boolProp name="TestElement.enabled">true</boolProp>
            <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
            <stringProp name="HTTPSampler.port">80</stringProp>
            <elementProp name="HTTPsampler.Arguments"
elementType="org.apache.jmeter.config.Arguments">
              <stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</stringProp>

              <stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>

              <collectionProp name="Arguments.arguments"/>
              <stringProp name="TestElement.name">User Defined
Variables</stringProp>
              <boolProp name="TestElement.enabled">true</boolProp>
            </elementProp>
            <stringProp name="HTTPSampler.mimetype"></stringProp>
            <stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</stringProp>

            <stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
            <stringProp name="TestElement.name">HTTP Request</stringProp>
            <stringProp name="HTTPSampler.monitor">false</stringProp>
            <stringProp name="HTTPSampler.domain">${URL}</stringProp>
            <stringProp name="HTTPSampler.FILE_NAME"></stringProp>
            <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
          </HTTPSampler>
          <hashTree/>
          <org.apache.jmeter.config.Arguments>
            <stringProp
name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</stringProp>

            <stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>

            <collectionProp name="Arguments.arguments">
              <elementProp name="URL"
elementType="org.apache.jmeter.config.Argument">
                <stringProp name="Argument.metadata">=</stringProp>
                <stringProp
name="Argument.value">http://www.microsoft.com</stringProp>
                <stringProp name="Argument.name">URL</stringProp>
              </elementProp>
            </collectionProp>
            <stringProp name="TestElement.name">URL set to
www.microsoft.com</stringProp>
            <boolProp name="TestElement.enabled">true</boolProp>
          </org.apache.jmeter.config.Arguments>
          <hashTree/>
          <HTTPSampler>
            <stringProp name="HTTPSampler.path"></stringProp>
            <stringProp
name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</stringProp>

            <stringProp name="HTTPSampler.method">GET</stringProp>
            <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
            <stringProp name="HTTPSampler.protocol"></stringProp>
            <boolProp name="TestElement.enabled">true</boolProp>
            <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
            <stringProp name="HTTPSampler.port">80</stringProp>
            <elementProp name="HTTPsampler.Arguments"
elementType="org.apache.jmeter.config.Arguments">
              <stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</stringProp>

              <stringProp
name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>

              <collectionProp name="Arguments.arguments"/>
              <stringProp name="TestElement.name">User Defined
Variables</stringProp>
              <boolProp name="TestElement.enabled">true</boolProp>
            </elementProp>
            <stringProp name="HTTPSampler.mimetype"></stringProp>
            <stringProp
name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</stringProp>

            <stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
            <stringProp name="TestElement.name">HTTP Request</stringProp>
            <stringProp name="HTTPSampler.monitor">false</stringProp>
            <stringProp name="HTTPSampler.domain">${URL}</stringProp>
            <stringProp name="HTTPSampler.FILE_NAME"></stringProp>
            <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
          </HTTPSampler>
          <hashTree/>
        </hashTree>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org

Mime
View raw message