【问题标题】:JMeter: After response of specific HttpRequest, wait 3 seconds to call next requestJMeter:特定HttpRequest响应后,等待3秒调用下一个请求
【发布时间】:2017-07-10 13:13:51
【问题描述】:

使用 JMeter,我正在尝试测试我的应用程序性能。

这是我第一次挖掘 JMeter。因此,如果缺少任何技术术语,请告诉我。

所以去我的查询,

我们的应用程序需要身份验证才能访问除登录和注册之外的任何请求。

我的测试计划如上。

A) Login Request (It should be call for every user first, then only (2) will perform)
    1) based on credential in CSV file    (Working)
    2) Post processing using BeanShell Post processor (Working)
    3) Store token and user id in variables for Next request (Working)
    4) The token will be sent through Every HttpRequest Header (Working)

B) Random Controller
   1) List of HttpRequest's 
        invoke HttpRequest randomly (Working)
   2) For Dashboard Request, after the getting the response, sleep 3 seconds and continue the flow. (only this thread will wait)

现在我需要的是,

1) 通常,当收到响应时,用户会阅读内容。有的反应大,有的反应小。所以阅读内容的时间取决于内容的大小。

我想在 JMeter 中实现同样的事情。收到 Dashboard 响应后,等待 3 秒(我会为不同的 Req 指定不同的时间),然后调用下一个随机 HttpRequest。

我尝试使用 Http Request--> 常量计时器。但它在请求之前工作(反向:在调用请求之前,等待特定时间)。

那么对我的测试计划设计有什么 Timer 帮助吗?

另外,我认为 BeanShell 后处理器可能会有所帮助。但没有找到任何东西。

【问题讨论】:

  • jmeter 太糟糕了,放弃吧

标签: jmeter


【解决方案1】:

我在这里看到 2 个选项:

  1. here 所述,使用控制器、测试操作和计时器。 IE。将事务控制器设置为仪表板请求的父级。在同一个控制器下添加Test Action,用固定或可变暂停来模拟延迟:

     Random Controller
       Transaction Controller
         Dashboard Request
         Test Action
       Other HTTP Request
    
  2. 使用 BeanShell 或任何其他可编程后处理器和相应语言的功能来暂停。例如,使用 BeanShell 后处理器,您可以

    Thread.sleep(3000); // pauses for 3 sec. after request
    

第二种解决方案似乎更短更快。但在语义上首先能更好地表达意图。

【讨论】:

  • 哦.. 与 Test Action 一样好用。谢谢你,基里尔。
  • 您提到的博客 (jmeter-tips.blogspot.in ) 非常有帮助。感谢 Victor Klepikovskiy
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-05-10
  • 2014-04-24
  • 1970-01-01
  • 2012-10-09
  • 2018-11-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多