Hi all,

I have a test plan which uses "switch controller" to distribute load to 2 HTTP request.

My test plan looks like this:

Thread Group
   -User Defined Variables
   -Beanshell Sampler
   -Java request
   -Switch Controller
      -HTTP Sampler1
      -HTTP Sampler2

1, In "User Defined Variables", I defined a variable named "RAND";
2, In Beanshell Sampler, code generated a random 0 or 1, then put the value to ${RAND}.

   int r = Math.rand()*10;
   if(r<5) vars.put("RAND", "0");
   else vars.put("RAND", "1");

3, Switch Controller used {$RAND} as its switch value.
4, The Java request is used to monitor the value generated by Beanshell script, so I just set Label as "RAND=${RAND}".

When run the test plan, I set 10 thread to run 100 loops, what
surprised me is the summary result:

   Label         #Samples  ...
  RAND=0            526
  RAND=1            474
  HTTP Sampler1     532
  HTTP Sampler2     468

What I expected is the #samples of "RAND=0" and "HTTP Sampler1" are the same, while the #samplers of "RAND=1" and "HTTP Sampler2" are the same.

Can anyone explain it?


Thanks,
Dennis



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

Reply via email to