Hi Sebb

This is my function.
I checked the values comming out for the switch it would be 0, 1, 2 . and i 
tried placing 3 request in simple controller also and also putting bean shell 
function inside __log(). but the order of sending request is not correct

${__BeanShell(if(${__Random(0,10,rand)} < 6){return 0;}else if(${rand} < 
9){return 1;}else{return 2;},switchVar)})

i am attaching you the logic script. am i missing something

Joseph

________________________________

From: sebb [mailto:[EMAIL PROTECTED]
Sent: Thu 11/22/2007 4:50 PM
To: JMeter Users List
Subject: Re: Proportioning of Request



On 22/11/2007, Joseph Ribin Roy <[EMAIL PROTECTED]> wrote:
>
> hi sebb
>
>     I have written a bean shell script which would return me 0,1,2 from the 
> random generation. but the switch is not working fine. Its not sending 
> request in expected order. I had read the issue in users mailing list. is it 
> a bug

Are you sure that the script is returning the correct values?
Add a Java Request sampler to check it, or enclose the function call in __log().

e.g. ${__log(${__beanShell(function code)})}

The Switch Controller should look like:

Switch Controller
+ Sampler 0
+ Sampler 1
+ Sampler 2

or you could use Simple Controller parents:

Switch Controller
+ Simple Controller
+ + Sampler 0
+ Simple Controller
+ + Sampler 1
+ Simple Controller
+ + Sampler 2

> so i thought of trying through put controller. i am not still clear how can i 
> proportionate using Throughput controller. can you through some light on this.

Just use a TC with the appropriate percentage as the parent of each sampler:

TC 1 (50%)
+ sampler 1
TC 2 (30%)
+ sampler 2

etc.

> ________________________________
>
> From: sebb [mailto:[EMAIL PROTECTED]
> Sent: Wed 11/21/2007 9:09 PM
> To: JMeter Users List
> Subject: Re: Proportioning of Request
>
>
>
> You could try:
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Throughput_Controller
>
> You would need one as a parent of each request, and you may not get
> exactly one of the samples per loop.
>
> Otherwise, I would probably use the Switch Controller:
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Switch_Controller
>
> in conjunction with a function that returns 0,1 or 2 in the
> appropriate proportions.
>
> e.g. generate a random number between 1 and 10 (inclusive) and then
> divide into suitable portions:
>
> 1-5 -> 0
> 6-8 -> 1
> 9-10 -> 2
>
> You could use javascript, jexl or beanshell for this.
>
> On 21/11/2007, Joseph Ribin Roy <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> >       I have 3 http request. Is it possible to send it in 50:30:20 ratio. 
> > Does any controller can do it. Putting it in different Thread group will 
> > help in doing it [spliting the user proportion]. But I ll have to rewrite 
> > other requests in all thread groups. Can any one through some light on this.
> >
> > Thanks
> > Joseph
> >
> >
> >
> > The information contained in, or attached to, this e-mail, contains 
> > confidential information and is intended solely for the use of the 
> > individual or entity to whom they are addressed and is subject to legal 
> > privilege. If you have received this e-mail in error you should notify the 
> > sender immediately by reply e-mail, delete the message from your system and 
> > notify your system manager. Please do not copy it for any purpose, or 
> > disclose its contents to any other person. The views or opinions presented 
> > in this e-mail are solely those of the author and do not necessarily 
> > represent those of the company. The recipient should check this e-mail and 
> > any attachments for the presence of viruses. The company accepts no 
> > liability for any damage caused, directly or indirectly, by any virus 
> > transmitted in this email.
> >
> > www.aztecsoft.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>
> The information contained in, or attached to, this e-mail, contains 
> confidential information and is intended solely for the use of the individual 
> or entity to whom they are addressed and is subject to legal privilege. If 
> you have received this e-mail in error you should notify the sender 
> immediately by reply e-mail, delete the message from your system and notify 
> your system manager. Please do not copy it for any purpose, or disclose its 
> contents to any other person. The views or opinions presented in this e-mail 
> are solely those of the author and do not necessarily represent those of the 
> company. The recipient should check this e-mail and any attachments for the 
> presence of viruses. The company accepts no liability for any damage caused, 
> directly or indirectly, by any virus transmitted in this email.
>
> www.aztecsoft.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






The information contained in, or attached to, this e-mail, contains 
confidential information and is intended solely for the use of the individual 
or entity to whom they are addressed and is subject to legal privilege. If you 
have received this e-mail in error you should notify the sender immediately by 
reply e-mail, delete the message from your system and notify your system 
manager. Please do not copy it for any purpose, or disclose its contents to any 
other person. The views or opinions presented in this e-mail are solely those 
of the author and do not necessarily represent those of the company. The 
recipient should check this e-mail and any attachments for the presence of 
viruses. The company accepts no liability for any damage caused, directly or 
indirectly, by any virus transmitted in this email.

www.aztecsoft.com
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="1.8">
  <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>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User 
Defined Variables" enabled="false">
        <collectionProp name="Arguments.arguments"/>
      </Arguments>
      <hashTree/>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" 
testname="Thread Group" enabled="true">
        <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">5</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1195711554000</longProp>
        <longProp name="ThreadGroup.end_time">1195711554000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" 
testname="HTTP Request" enabled="false">
          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" 
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined 
Variables" enabled="true">
            <collectionProp name="Arguments.arguments"/>
          </elementProp>
          <stringProp name="HTTPSampler.domain">ggg</stringProp>
          <stringProp name="HTTPSampler.port"></stringProp>
          <stringProp name="HTTPSampler.protocol"></stringProp>
          <stringProp name="HTTPSampler.method">GET</stringProp>
          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
          <stringProp 
name="HTTPSampler.path">/${__BeanShell(if(${__Random(0,10,rand)} &gt; 5){return 
1;},switchVar)}</stringProp>
          <boolProp name="HTTPSampler.follow_redirects">false</boolProp>
          <boolProp name="HTTPSampler.auto_redirects">true</boolProp>
          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
          <stringProp name="HTTPSampler.mimetype"></stringProp>
          <stringProp name="HTTPSampler.FILE_NAME"></stringProp>
          <stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
          <stringProp name="HTTPSampler.monitor">false</stringProp>
          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
        </HTTPSampler>
        <hashTree/>
        <ThroughputController guiclass="ThroughputControllerGui" 
testclass="ThroughputController" testname="Throughput Controller" 
enabled="false">
          <intProp name="ThroughputController.style">0</intProp>
          <boolProp name="ThroughputController.perThread">true</boolProp>
          <stringProp 
name="ThroughputController.maxThroughput">50.0</stringProp>
          <FloatProperty>
            <value>50.0</value>
            <savedValue>0.0</savedValue>
            <name>ThroughputController.percentThroughput</name>
          </FloatProperty>
        </ThroughputController>
        <hashTree/>
        <SwitchController guiclass="SwitchControllerGui" 
testclass="SwitchController" testname="Switch Controller" enabled="true">
          <intProp name="InterleaveControl.style">1</intProp>
          <stringProp 
name="SwitchController.value">${__BeanShell(if(${__Random(0,10,rand)} &lt; 
6){return 0;}else if(${rand} &lt; 9){return 1;}else{return 
2;},switchVar)})</stringProp>
        </SwitchController>
        <hashTree>
          <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" 
testname="a" enabled="true">
            <elementProp name="HTTPsampler.Arguments" elementType="Arguments" 
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined 
Variables" enabled="true">
              <collectionProp name="Arguments.arguments"/>
            </elementProp>
            <stringProp name="HTTPSampler.domain">aaa</stringProp>
            <stringProp name="HTTPSampler.port"></stringProp>
            <stringProp name="HTTPSampler.protocol"></stringProp>
            <stringProp name="HTTPSampler.method">GET</stringProp>
            <stringProp name="HTTPSampler.contentEncoding"></stringProp>
            <stringProp 
name="HTTPSampler.path">/aaa/rand=${rand}/switch=${switchVar}</stringProp>
            <boolProp name="HTTPSampler.follow_redirects">false</boolProp>
            <boolProp name="HTTPSampler.auto_redirects">true</boolProp>
            <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
            <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
            <stringProp name="HTTPSampler.mimetype"></stringProp>
            <stringProp name="HTTPSampler.FILE_NAME"></stringProp>
            <stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
            <stringProp name="HTTPSampler.monitor">false</stringProp>
            <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
          </HTTPSampler>
          <hashTree/>
          <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" 
testname="b" enabled="true">
            <elementProp name="HTTPsampler.Arguments" elementType="Arguments" 
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined 
Variables" enabled="true">
              <collectionProp name="Arguments.arguments"/>
            </elementProp>
            <stringProp name="HTTPSampler.domain">bbb</stringProp>
            <stringProp name="HTTPSampler.port"></stringProp>
            <stringProp name="HTTPSampler.protocol"></stringProp>
            <stringProp name="HTTPSampler.method">GET</stringProp>
            <stringProp name="HTTPSampler.contentEncoding"></stringProp>
            <stringProp name="HTTPSampler.path">/bbb/rand=${rand}/switch= 
${switchVar}</stringProp>
            <boolProp name="HTTPSampler.follow_redirects">false</boolProp>
            <boolProp name="HTTPSampler.auto_redirects">true</boolProp>
            <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
            <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
            <stringProp name="HTTPSampler.mimetype"></stringProp>
            <stringProp name="HTTPSampler.FILE_NAME"></stringProp>
            <stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
            <stringProp name="HTTPSampler.monitor">false</stringProp>
            <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
          </HTTPSampler>
          <hashTree/>
          <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" 
testname="c" enabled="true">
            <elementProp name="HTTPsampler.Arguments" elementType="Arguments" 
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined 
Variables" enabled="true">
              <collectionProp name="Arguments.arguments"/>
            </elementProp>
            <stringProp name="HTTPSampler.domain">ccc</stringProp>
            <stringProp name="HTTPSampler.port"></stringProp>
            <stringProp name="HTTPSampler.protocol"></stringProp>
            <stringProp name="HTTPSampler.method">GET</stringProp>
            <stringProp name="HTTPSampler.contentEncoding"></stringProp>
            <stringProp name="HTTPSampler.path">/ccc/rand=${rand}/switch= 
${switchVar}</stringProp>
            <boolProp name="HTTPSampler.follow_redirects">false</boolProp>
            <boolProp name="HTTPSampler.auto_redirects">true</boolProp>
            <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
            <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
            <stringProp name="HTTPSampler.mimetype"></stringProp>
            <stringProp name="HTTPSampler.FILE_NAME"></stringProp>
            <stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
            <stringProp name="HTTPSampler.monitor">false</stringProp>
            <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
          </HTTPSampler>
          <hashTree/>
        </hashTree>
        <ResultCollector guiclass="ViewResultsFullVisualizer" 
testclass="ResultCollector" testname="View Results Tree" enabled="true">
          <boolProp name="ResultCollector.error_logging">false</boolProp>
          <objProp>
            <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>true</xml>
              <fieldNames>false</fieldNames>
              <responseHeaders>false</responseHeaders>
              <requestHeaders>false</requestHeaders>
              <responseDataOnError>false</responseDataOnError>
              
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
              <assertionsResultsToSave>0</assertionsResultsToSave>
              <bytes>true</bytes>
            </value>
            <name>saveConfig</name>
          </objProp>
          <stringProp name="filename"></stringProp>
        </ResultCollector>
        <hashTree/>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to