I have two user classes:
- SyncUser
- NormalUser
with the following code:
class syncUser(HttpUser):
host = '<hostname>'
def on_start(self):
self.userId = getsyncPullUser()
self.headers = {
"Content-Type": "application/json"
}
@task
def SyncUser(self):
timeout=10
params = {
"timeout":timeout,
}
while True:
response = self.client.get("/sync/api", headers = self.headers, params = params, name="GET_sync/api")
class NormalUser(HttpUser):
host = '<hostname>'
def on_start(self):
self.userId = getuser()
self.headers = {
"Content-Type": "application/json",
}
@task
def getmessages(self):
params = {
"status":"ACCEPTED",
"source":"postman"
}
self.client.get("/<api>", headers = self.headers, params = params, name="GET /<api>")
I want to create NormalUser after SyncUser. This is done to make sure the userIds assigned to NormalUser(using getuser()
) are a subset of users assigned to SyncUser (using getsyncPullUser()
).
Need help in how to do this.
If there is a way to run multiple tasks simultaneously, that also solves my problem, as I will run the syncUser
function in parallel and I won’t need a new class.
6