main.py 549 字节
Newer Older
6
UPDATE  
63846d858c742721fa5a7f94 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
from locust import HttpUser, TaskSet, task
import urllib3


urllib3.disable_warnings()


class UserBehavior(TaskSet):

    def on_start(self):
        print("start****")

    def on_stop(self):
        print("stop****")

    @task(1)
    def baidu_page1(self):
        res = self.client.get("/", verify=False)


class WebsiteUser(HttpUser):
    tasks = [UserBehavior]
    host = "https://www.baidu.com"
    min_wait = 1000
    max_wait = 2000


if __name__ == '__main__':
    import os
    os.system("locust -f main.py --host=https://www.baidu.com")