【发布时间】:2022-06-14 11:38:14
【问题描述】:
我有一个 raact Web 应用程序,我正在使用 locust 在这两个 URL 上对其进行负载测试。 (主页和隐私政策页面)。对于主页,它正在工作,但对于隐私页面,它给出“HTTPError('404 Client Error: Not Found for url: https://xxx/privacy-policy/')”错误。当我在浏览器上点击这些 URL 时,URL 都打开并且没有给出任何错误。为什么 Locust 会出现这个错误。
这是我的代码 -
import time
from locust import HttpUser, task, constant
class CreateLead(HttpUser):
host = "https://xxx"
wait_time = constant(0)
@task
def loadtest(self):
self.client.get("/")
time.sleep(1)
self.client.get("/privacy-policy")
time.sleep(1)
【问题讨论】:
-
如果你避免使用斜杠并使用
https://xxx/privacy-policy,看看它是否有效 -
@Kris,请检查我的代码,我现在已经添加,第一个请求正在运行,第二个给出了这个错误,斜线是由蝗虫而不是我添加的。
-
请澄清您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: python performance-testing load-testing script locust