【问题标题】:Locust giving "HTTPError('404 Client Error: Not Found for url: https://xxx/privacy-policy/') " error, while https://xxx/ working. how to resolv this [closed]蝗虫给出“HTTPError('404 Client Error: Not Found for url: https://xxx/privacy-policy/')”错误,而 https://xxx/ 工作。如何解决这个问题[关闭]
【发布时间】: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


猜你喜欢
  • 2022-08-16
  • 2019-12-27
  • 1970-01-01
  • 2022-06-10
  • 1970-01-01
  • 2023-03-10
  • 2020-05-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多