Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time,randint,config
- users = 1000
- users_rate = 10
- class UserBehavior(TaskSet):
- wait_secs = config.wait_for_locusts_to_hatch(locusts_num=users, hatch_rate=users_rate)
- def on_start(self):
- print "-----Start of locust run-----"
- user_num = random.randint(602, 10000)
- username = "user_%s" % user_num
- password = "secret"
- # required time to hatch the users
- config.load_sleep(self.wait_secs, self.wait_secs)
- self.login_use(user_num, username, password)
- print "-----End of locust run-----"
- # This should be imported from a config file
- # def wait_for_locusts_to_hatch(locusts_num, hatch_rate):
- # wait_secs = (locusts_num / hatch_rate) + 10 # +10 to be safe
- # print "-- Waiting %s secs for locusts to hatch --" % wait_secs
- # return wait_secs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement