Skip to content

tasks are not shown in locust UI statistics #591

@habhilash

Description

@habhilash

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions