Adding a random selector to a schedule

A schedule that contains only user groups and tests will run each test in a user group sequentially. Adding a random selector lets you repeat a series of tests in random order, thus emulating the varied actions of real users.

To add a random selector:
  1. In the Test Navigator, expand the project until you locate the schedule.
  2. Right-click the schedule, and then click Open.
  3. Click the name of the schedule item to contain the random selector, and then click Add > Random Selector.
  4. In the Schedule Element Details section, add the number of iterations to loop.

    Think of yourself as a "random selector." You are blindfolded, and you have a bucket that contains 10 red balls and 10 green balls. You have a 50% chance of picking a red ball, and a 50% chance of picking a green ball. You pick a ball randomly—it is red. You then replace the ball in the bucket. Every time you pick a ball, you have a 50% chance of getting a red ball. Because the ball is replaced after each selection, the bucket always contains 10 red balls and 10 green balls. It is even possible (but unlikely) that you will pick a red ball every time.

  5. Set a weight to control the randomness of this selection:
    1. Right-click the random selector and select Add > Weighted Block.
    2. In the Weight field, enter an integer. This integer shows the relative proportion that each test runs.

    Assume that a random selector contains two tests: Browse and Bid. You assign Browse a weight of 7 and Bid a weight of 3. Each time the loop is executed, Browse has a 70% chance, and Bid has a 30% chance, of being selected.


    schedule with two scripts of different weights

Parent topic: Adding elements to a schedule

Terms of use | Feedback
(C) Copyright IBM Corporation 2005. All Rights Reserved.