I am trying to run locust using pytest. I have created this python file but it is not showing any output. pytest doesnot collect the test. How can I use locust with pytest
from locust import HttpUser, TaskSet, task
class WebsiteTasks(TaskSet):
def on_start(self):
self.index()
@task(2)
def index(self):
self.client.get("/")
@task(1)
def about(self):
self.client.get("/page/about")
class WebsiteUser(HttpUser):
task = WebsiteTasks
host = "localhost:5000"
min_wait = 1000
max_wait = 5000
When I run pytest locust_test.py this is the output:
================================================================ test session starts ================================================================
platform linux -- Python 3.8.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/user/Desktop/testing
collected 0 items