-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Description
Following is my locust file :
`
from locust import HttpLocust, TaskSet, task
import yaml
import os
import sys
sys.path.append(os.getcwd())
class EntitySearchLoadTask(TaskSet):
def on_start(self):
self.login()
def login(self):
with self.client.get("/application/auth?action=login", catch_response=True,
auth=('<username>', '<password>'), name='Login') as response:
print "login"
print "status : " + str(response.status_code)
global headers
headers = {}
headers['Cookie'] = response.headers.get('Set-Cookie')
headers['X-CSRF-TOKEN'] = response.cookies['X-CSRF-TOKEN']
if response.status_code != 200:
print "status : "
print str(response.status_code)
print "content : "
print response.content
response.failure("Controller Login API failed : " + response.content)
@task(1)
def sampleTask(self):
global headers
print "task"
res = self.client.get("/application/restui/entity/search?searchText=tier 4", catch_response=True,
headers = headers)
print res.status_code
print "content : "
print res.json
class EntitySearchUserLocust(HttpLocust):
task_set = EntitySearchLoadTask
min_wait = 1000
max_wait = 5000
`
- Now, I see on_start is getting executed ever user. I just want on_start to be executed once for all hatches. Is there any solution ?
- I donot see @task decorated API ("/application/restui/entity/search?searchText=tier 4") in statistics in locust UI. Please refer to the attached screenshot. But @task is getting executed as per log. Only Login API is seen which is written in on_start(self) method.
Its little urgent. Can someone help me ?
Metadata
Metadata
Assignees
Labels
No labels