You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
766 B

from locust import HttpUser, TaskSet, task
from faker import Faker
class RegistredUser(HttpUser):
min_wait = 5000
max_wait = 9000
@task
class GeolocationStresstest(TaskSet):
def __init__(self, parent):
super().__init__(parent)
self.__faker = Faker("en_US")
@task(1)
def add_location(self):
coordonates = self.__faker.location_on_land()
data = {
'lat': coordonates[0],
'lng': coordonates[1],
'name': coordonates[2]
}
self.client.post('/location', data)
@task(2)
def search(self):
self.client.get('/location/{0}/{1}'.format(self.__faker.latitude(), self.__faker.longitude()))