You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by pubudu thilakaratne <pu...@gmail.com> on 2015/08/04 18:29:33 UTC

Randomizing Loop controller Repetition Behaviour

I want to include following behavior in my jmeter test script

My test plan have 3 transaction controllers Search,ViewItem and CreateItem.
Those transaction are located inside loop controllers as I want each one to
run in different ratios for a one iteration.

Test Plan
Thread Group 1
Loop Controller 1 (3 times) > Search TC
Loop Controller 1 (2 times) > ViewItem TC
Loop Controller 1 (1 time) > CreateItem TC

So the normal execution behaviour would be as below

User 1 Iteration 1 :Search TC, Search TC, Search TC, ViewItem TC, ViewItem
TC, CreateItem TC

But I wanted to randomize the repition of Transaction controllers inside
same iteration, some thing like  below.

User 1 Iteration 1 :Search TC,Search TC, ViewItem TC, CreateItem TC,
ViewItem TC, Search TC

so at the end of the test each transaction controller has been executed in
various ratios but repeat in a random manner. Is this possible?

Please share  your valuable idea on this

Thanks and regards
Pubudu

Re: Randomizing Loop controller Repetition Behaviour

Posted by Flavio Cysne <fl...@gmail.com>.
Sorry, sent again to correct what I said in the second paragraph.

> Create a CSV file containing that random order and use its values to
designate what sampler will be executed.

> From the example I wrote, remove the Loop Controller and use Thread group
loop count, if there is no login-thing or something else involved. If there
is something else, keep the Loop Controller and use the __CSVRead function.

> Instead of using the random function to determine the order, you'll use a
CSV file; so you can control the number of times each sampler will be
executed.

Re: Randomizing Loop controller Repetition Behaviour

Posted by Flavio Cysne <fl...@gmail.com>.
Create a CSV file containing that random order and use its values to
designate what sampler will be executed.

>From the example I wrote, remove the Loop Controller and use Thread group
loop count, if there is no login-thing or something else involved. If there
isn't something else, keep the Loop Controller and use the __CSVRead
function.

Instead of using the random function to determine the order, you'll use a
CSV file; so you can control the number of times each sampler will be
executed.

Re: Randomizing Loop controller Repetition Behaviour

Posted by Deepak Shetty <sh...@gmail.com>.
>(The more I think about this, the more I tend to number one :)
To nitpick :)
It doesnt guarantee the  3:2:1 ratio (similar to any other random scheme) -
though I think that requirement is incorrect ...

regards
deepak

On Wed, Aug 5, 2015 at 8:26 AM, Felix Schumacher <
felix.schumacher@internetallee.de> wrote:

>
>
> Am 5. August 2015 08:44:14 MESZ, schrieb pubudu thilakaratne <
> pubuduv6@gmail.com>:
> >Hi
> >
> >Thanks for the reply . But what I want to do is bit different than
> >this. I
> >want to repeat Search TC for 3 times, ViewItem TC for 2 times
> >and CreateItem TC for once. But this repetition need to be done in a
> >random
> >manner. But at the end of the test  Search TC must executed for  3
> >times ,ViewItem
> >TC for 2 times and CreateItem TC for once. And all the Samplers should
> >be
> >executed.
>
> If you want an overall ratio instead of per user, you can modify the if
> statements to check for a range. For example for search the random number
> must be within 1 and 3, for view it has to be between 4 and 5 and for
> create it has to be 6.
>
> If the ratio has to be per user, you have at least two possibilities:
>
> 1. Use a random order Controller (
> http://jmeter.apache.org/usermanual/component_reference.html#Random_Order_Controller)
> and put search three times, view two times and create one times into the
> controller. You might want to look at modules so you don't have to repeat
> yourself.
>
> 2. Use Javascript to get an index with the correct ratio and use a switch
> Controller (
> http://jmeter.apache.org/usermanual/component_reference.html#Switch_Controller
> ).
> This could be achieved by an array with the names of the Samplers in the
> correct ratio, e.g. three times search, two times view and one create.
> Shuffling that array and then looping over it.
> (The more I think about this, the more I tend to number one :)
>
> Regards,
>
> Felix
>
> >
> >Thanks and Regards
> >Pubudu
> >
> >
> >
> >On 4 August 2015 at 22:52, Flavio Cysne <fl...@gmail.com> wrote:
> >
> >> Loop Controller: 6 times
> >>     - Random 1 through 3
> >>     - If Controller: randNum == 1
> >>         - Search sampler
> >>     - If Controller: randNum == 2
> >>         - ViewItem sampler
> >>     - If Controller: randNum == 3
> >>         - CreateItem sampler
> >> Em 04/08/2015 13:29, "pubudu thilakaratne" <pu...@gmail.com>
> >escreveu:
> >>
> >> > I want to include following behavior in my jmeter test script
> >> >
> >> > My test plan have 3 transaction controllers Search,ViewItem and
> >> CreateItem.
> >> > Those transaction are located inside loop controllers as I want
> >each one
> >> to
> >> > run in different ratios for a one iteration.
> >> >
> >> > Test Plan
> >> > Thread Group 1
> >> > Loop Controller 1 (3 times) > Search TC
> >> > Loop Controller 1 (2 times) > ViewItem TC
> >> > Loop Controller 1 (1 time) > CreateItem TC
> >> >
> >> > So the normal execution behaviour would be as below
> >> >
> >> > User 1 Iteration 1 :Search TC, Search TC, Search TC, ViewItem TC,
> >> ViewItem
> >> > TC, CreateItem TC
> >> >
> >> > But I wanted to randomize the repition of Transaction controllers
> >inside
> >> > same iteration, some thing like  below.
> >> >
> >> > User 1 Iteration 1 :Search TC,Search TC, ViewItem TC, CreateItem
> >TC,
> >> > ViewItem TC, Search TC
> >> >
> >> > so at the end of the test each transaction controller has been
> >executed
> >> in
> >> > various ratios but repeat in a random manner. Is this possible?
> >> >
> >> > Please share  your valuable idea on this
> >> >
> >> > Thanks and regards
> >> > Pubudu
> >> >
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: Randomizing Loop controller Repetition Behaviour

Posted by Felix Schumacher <fe...@internetallee.de>.

Am 5. August 2015 08:44:14 MESZ, schrieb pubudu thilakaratne <pu...@gmail.com>:
>Hi
>
>Thanks for the reply . But what I want to do is bit different than
>this. I
>want to repeat Search TC for 3 times, ViewItem TC for 2 times
>and CreateItem TC for once. But this repetition need to be done in a
>random
>manner. But at the end of the test  Search TC must executed for  3
>times ,ViewItem
>TC for 2 times and CreateItem TC for once. And all the Samplers should
>be
>executed.

If you want an overall ratio instead of per user, you can modify the if statements to check for a range. For example for search the random number must be within 1 and 3, for view it has to be between 4 and 5 and for create it has to be 6.

If the ratio has to be per user, you have at least two possibilities:

1. Use a random order Controller ( http://jmeter.apache.org/usermanual/component_reference.html#Random_Order_Controller) and put search three times, view two times and create one times into the controller. You might want to look at modules so you don't have to repeat yourself. 

2. Use Javascript to get an index with the correct ratio and use a switch Controller ( http://jmeter.apache.org/usermanual/component_reference.html#Switch_Controller).
This could be achieved by an array with the names of the Samplers in the correct ratio, e.g. three times search, two times view and one create. Shuffling that array and then looping over it. 
(The more I think about this, the more I tend to number one :)

Regards, 

Felix

>
>Thanks and Regards
>Pubudu
>
>
>
>On 4 August 2015 at 22:52, Flavio Cysne <fl...@gmail.com> wrote:
>
>> Loop Controller: 6 times
>>     - Random 1 through 3
>>     - If Controller: randNum == 1
>>         - Search sampler
>>     - If Controller: randNum == 2
>>         - ViewItem sampler
>>     - If Controller: randNum == 3
>>         - CreateItem sampler
>> Em 04/08/2015 13:29, "pubudu thilakaratne" <pu...@gmail.com>
>escreveu:
>>
>> > I want to include following behavior in my jmeter test script
>> >
>> > My test plan have 3 transaction controllers Search,ViewItem and
>> CreateItem.
>> > Those transaction are located inside loop controllers as I want
>each one
>> to
>> > run in different ratios for a one iteration.
>> >
>> > Test Plan
>> > Thread Group 1
>> > Loop Controller 1 (3 times) > Search TC
>> > Loop Controller 1 (2 times) > ViewItem TC
>> > Loop Controller 1 (1 time) > CreateItem TC
>> >
>> > So the normal execution behaviour would be as below
>> >
>> > User 1 Iteration 1 :Search TC, Search TC, Search TC, ViewItem TC,
>> ViewItem
>> > TC, CreateItem TC
>> >
>> > But I wanted to randomize the repition of Transaction controllers
>inside
>> > same iteration, some thing like  below.
>> >
>> > User 1 Iteration 1 :Search TC,Search TC, ViewItem TC, CreateItem
>TC,
>> > ViewItem TC, Search TC
>> >
>> > so at the end of the test each transaction controller has been
>executed
>> in
>> > various ratios but repeat in a random manner. Is this possible?
>> >
>> > Please share  your valuable idea on this
>> >
>> > Thanks and regards
>> > Pubudu
>> >
>>


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


Re: Randomizing Loop controller Repetition Behaviour

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
take a look at the various controllers - In particular the Throughput
Controller and Random order controller. You can use the throughput
controller to do things like Search executes 1.5 times as ViewItem and 3
times as much as CreateItem.
Threadgroup
+RandomOrder
++Throughput (Percent , 50%)
+++Search
++Throughput(Percent, 33..33)
+++View
++Throughput(Percent, 16.67)
+++Create

Note that the 3 times as much - alongside random probably wont work too
well for randomness ...

regards
deepak

On Tue, Aug 4, 2015 at 11:44 PM, pubudu thilakaratne <pu...@gmail.com>
wrote:

> Hi
>
> Thanks for the reply . But what I want to do is bit different than this. I
> want to repeat Search TC for 3 times, ViewItem TC for 2 times
> and CreateItem TC for once. But this repetition need to be done in a random
> manner. But at the end of the test  Search TC must executed for  3
> times ,ViewItem
> TC for 2 times and CreateItem TC for once. And all the Samplers should be
> executed.
>
> Thanks and Regards
> Pubudu
>
>
>
> On 4 August 2015 at 22:52, Flavio Cysne <fl...@gmail.com> wrote:
>
> > Loop Controller: 6 times
> >     - Random 1 through 3
> >     - If Controller: randNum == 1
> >         - Search sampler
> >     - If Controller: randNum == 2
> >         - ViewItem sampler
> >     - If Controller: randNum == 3
> >         - CreateItem sampler
> > Em 04/08/2015 13:29, "pubudu thilakaratne" <pu...@gmail.com>
> escreveu:
> >
> > > I want to include following behavior in my jmeter test script
> > >
> > > My test plan have 3 transaction controllers Search,ViewItem and
> > CreateItem.
> > > Those transaction are located inside loop controllers as I want each
> one
> > to
> > > run in different ratios for a one iteration.
> > >
> > > Test Plan
> > > Thread Group 1
> > > Loop Controller 1 (3 times) > Search TC
> > > Loop Controller 1 (2 times) > ViewItem TC
> > > Loop Controller 1 (1 time) > CreateItem TC
> > >
> > > So the normal execution behaviour would be as below
> > >
> > > User 1 Iteration 1 :Search TC, Search TC, Search TC, ViewItem TC,
> > ViewItem
> > > TC, CreateItem TC
> > >
> > > But I wanted to randomize the repition of Transaction controllers
> inside
> > > same iteration, some thing like  below.
> > >
> > > User 1 Iteration 1 :Search TC,Search TC, ViewItem TC, CreateItem TC,
> > > ViewItem TC, Search TC
> > >
> > > so at the end of the test each transaction controller has been executed
> > in
> > > various ratios but repeat in a random manner. Is this possible?
> > >
> > > Please share  your valuable idea on this
> > >
> > > Thanks and regards
> > > Pubudu
> > >
> >
>

Re: Randomizing Loop controller Repetition Behaviour

Posted by pubudu thilakaratne <pu...@gmail.com>.
Hi

Thanks for the reply . But what I want to do is bit different than this. I
want to repeat Search TC for 3 times, ViewItem TC for 2 times
and CreateItem TC for once. But this repetition need to be done in a random
manner. But at the end of the test  Search TC must executed for  3
times ,ViewItem
TC for 2 times and CreateItem TC for once. And all the Samplers should be
executed.

Thanks and Regards
Pubudu



On 4 August 2015 at 22:52, Flavio Cysne <fl...@gmail.com> wrote:

> Loop Controller: 6 times
>     - Random 1 through 3
>     - If Controller: randNum == 1
>         - Search sampler
>     - If Controller: randNum == 2
>         - ViewItem sampler
>     - If Controller: randNum == 3
>         - CreateItem sampler
> Em 04/08/2015 13:29, "pubudu thilakaratne" <pu...@gmail.com> escreveu:
>
> > I want to include following behavior in my jmeter test script
> >
> > My test plan have 3 transaction controllers Search,ViewItem and
> CreateItem.
> > Those transaction are located inside loop controllers as I want each one
> to
> > run in different ratios for a one iteration.
> >
> > Test Plan
> > Thread Group 1
> > Loop Controller 1 (3 times) > Search TC
> > Loop Controller 1 (2 times) > ViewItem TC
> > Loop Controller 1 (1 time) > CreateItem TC
> >
> > So the normal execution behaviour would be as below
> >
> > User 1 Iteration 1 :Search TC, Search TC, Search TC, ViewItem TC,
> ViewItem
> > TC, CreateItem TC
> >
> > But I wanted to randomize the repition of Transaction controllers inside
> > same iteration, some thing like  below.
> >
> > User 1 Iteration 1 :Search TC,Search TC, ViewItem TC, CreateItem TC,
> > ViewItem TC, Search TC
> >
> > so at the end of the test each transaction controller has been executed
> in
> > various ratios but repeat in a random manner. Is this possible?
> >
> > Please share  your valuable idea on this
> >
> > Thanks and regards
> > Pubudu
> >
>

Re: Randomizing Loop controller Repetition Behaviour

Posted by Flavio Cysne <fl...@gmail.com>.
Loop Controller: 6 times
    - Random 1 through 3
    - If Controller: randNum == 1
        - Search sampler
    - If Controller: randNum == 2
        - ViewItem sampler
    - If Controller: randNum == 3
        - CreateItem sampler
Em 04/08/2015 13:29, "pubudu thilakaratne" <pu...@gmail.com> escreveu:

> I want to include following behavior in my jmeter test script
>
> My test plan have 3 transaction controllers Search,ViewItem and CreateItem.
> Those transaction are located inside loop controllers as I want each one to
> run in different ratios for a one iteration.
>
> Test Plan
> Thread Group 1
> Loop Controller 1 (3 times) > Search TC
> Loop Controller 1 (2 times) > ViewItem TC
> Loop Controller 1 (1 time) > CreateItem TC
>
> So the normal execution behaviour would be as below
>
> User 1 Iteration 1 :Search TC, Search TC, Search TC, ViewItem TC, ViewItem
> TC, CreateItem TC
>
> But I wanted to randomize the repition of Transaction controllers inside
> same iteration, some thing like  below.
>
> User 1 Iteration 1 :Search TC,Search TC, ViewItem TC, CreateItem TC,
> ViewItem TC, Search TC
>
> so at the end of the test each transaction controller has been executed in
> various ratios but repeat in a random manner. Is this possible?
>
> Please share  your valuable idea on this
>
> Thanks and regards
> Pubudu
>