Home > Blockchain >  How to segregate locust chart based on tag?
How to segregate locust chart based on tag?

Time:07-05

Currently I am using locust to test my own Java webservice APIs, I can segregate the test in the locust file by creating different definition / @task like the code below, even I put the tag annotation

from locust import HttpUser, task, tag
import json

class ProfileTest(HttpUser):

@tag('base')
@task
def base(self):
    payload = {"msisdn": "6289000000"}
    headers = {'content-type': 'application/json'}
    self.client.post("/api/v1/profile/base", data=json.dumps(payload), headers=headers)

@tag('generic')
@task
def generic(self):
    payload = {"msisdn": "6289000000"}
    headers = {'content-type': 'application/json'}
    self.client.post("/api/v1/profile/generic", data=json.dumps(payload), headers=headers)

Now I start the locust and the test also, it is showing properly

enter image description here

enter image description here

But in the chart I can't see the segregation of line. So how to segregate the chart line based on tag or even task? Any suggestion will be appreciated thanks

CodePudding user response:

There is no built-in graph that separates by task/tag. But you can use locust-plugins’s dashboard for more advanced reporting: https://github.com/SvenskaSpel/locust-plugins/blob/master/locust_plugins/dashboards/README.md

(that doesnt actually support filtering by tag/task either, but you can select/deselect by request name or even make your own graphs)

  • Related