Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i run the functions randomly in jython script?

class TestRunner:
    def __call__(self):
        user1()
        user2()
        user3()
        user4()

How do I execute the users randomly in jython, to run in grinder tool?

like image 911
srp Avatar asked Dec 05 '25 08:12

srp


1 Answers

Store the functions in a list (without calling them), then use random.shuffle:

import random

class TestRunner:
    def __call__(self):
        users = [user1, user2, user3, user4]
        random.shuffle(users)
        for user in users:
            user()
like image 55
Martijn Pieters Avatar answered Dec 07 '25 20:12

Martijn Pieters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!