File: debugging_advanced.py

package info (click to toggle)
locust 2.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,828 kB
  • sloc: javascript: 52,230; python: 20,862; sh: 118; makefile: 29
file content (30 lines) | stat: -rw-r--r-- 655 bytes parent folder | download
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, run_single_user, task
from locust.exception import StopUser


class User1(HttpUser):
    host = "http://localhost"

    @task
    def hello_world(self):
        with self.client.get("/hello1", catch_response=True) as resp:
            pass
        raise StopUser()


class User2(HttpUser):
    host = "http://localhost"

    @task
    def hello_world(self):
        with self.client.get("/hello2", catch_response=True) as resp:
            pass
        raise StopUser()


if __name__ == "__main__":
    print("running User1")
    run_single_user(User1)
    print("running User2")
    run_single_user(User2)
    print("done!")