ฉันมีโลคัสไฟล์พร้อมชุดกรณีทดสอบ (@task) มีตัวเลือก CLI ใดบ้างเพื่อให้ฉันสามารถแยกวิเคราะห์ไฟล์ตั๊กแตนและรับกรณีทดสอบหรือแท็กจากมัน พิจารณาโค้ดตัวอย่างด้านล่างจาก https://github.com/locustio/locust/blob/master/examples/basic.py ที่นี่ มีกรณีทดสอบหน้าเดียว page404() ซึ่งกำหนดโดย @task
from locust import HttpUser, TaskSet, task, between
def index(l):
l.client.get("/")
def stats(l):
l.client.get("/stats/requests")
class UserTasks(TaskSet):
# one can specify tasks like this
tasks = [index, stats]
# but it might be convenient to use the @task decorator
@task
def page404(self):
self.client.get("/does_not_exist")
class WebsiteUser(HttpUser):
"""
User class that does requests to the locust web server running on localhost
"""
host = "http://127.0.0.1:8089"
wait_time = between(2, 5)
tasks = [UserTasks]