post call如何与LOcustIO合作?我怀疑Locust没有做它应该做的事情,因为它返回了我正在运行的所有负载测试的成功,所以我决定发布,通过一个使用LocustIO的web应用程序写入DB,令我惊讶的是没有写入DB。虽然我知道有些人已经成功地做到了这一点,但我想知道如何使用ocastio编写数据库,作为负载测试的一部分。你知道吗
使用的代码如下:
from locust import HttpLocust, TaskSet, task
import logging, sys
from credentials import *
class LoginWithUniqueUsersSteps(TaskSet):
institutionCode = "NOT_FOUND"
username = "NOT_FOUND"
password = "NOT_FOUND"
def on_start(self):
if len(USER_CREDENTIALS) > 0:
self.institutionCode, self.username, self.password = USER_CREDENTIALS.pop()
@task
def login(self):
self.client.post("/dejavuweb/", {
'institutionCode': self.institutionCode, 'email': self.username, 'password': self.password
})
logging.info('Login with %s institutionCode %s username and %s password', self.institutionCode, self.username, self.password)
@task
def createTerminal(self):
response = self.client.request(method="POST", url="/dejavuweb/Home#Function/7", data= {"TerminalName": "RealterminalName"})
print("Create; Response status code:", response.status_code)
print("Create; Response content:", response.content)
class LoginWithUniqueUsersTest(HttpLocust):
task_set = LoginWithUniqueUsersSteps
host = "http://dev.trublend.cloud"
sock = None
def __init__(self):
super(LoginWithUniqueUsersTest, self).__init__()
请注意,我复制、编辑了上面的代码片段以实现我想要的。你知道吗
LocustIO结果截图:
目前没有回答
相关问题 更多 >
编程相关推荐