Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tasks are not shown in locust UI statistics #591

Closed
habhilash opened this issue May 23, 2017 · 2 comments
Closed

tasks are not shown in locust UI statistics #591

habhilash opened this issue May 23, 2017 · 2 comments

Comments

@habhilash
Copy link

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
`

  1. 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 ?
  2. 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 ?

screen shot 2017-05-24 at 12 27 46 am

@karol-brejna-i
Copy link
Contributor

At the first glance, the call you do in your task uses catch_response. This means you should mark the request either successful or failed which you don't. That's why it is not registered at all.

Probably too late, but may the answer may help somebody in the future.

@karol-brejna-i
Copy link
Contributor

@heyman, I think this one can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants