【问题标题】:Jmeter - Run Requests inside the thread consecutively and not at the same timeJmeter - 在线程内连续而不是同时运行请求
【发布时间】:2020-11-21 18:51:55
【问题描述】:

如何在线程内连续运行请求,而不是同时使用 Jmeter(一个接一个)。我想一次实现以下一个。

Thread 1 - Create Product

Create Product
Create Product
Create Product
Create Product
Create Product
Create Product
Create Product
Create Product
Create Product
Create Product

Thread 2 - Get Product by Id

Get Product By Id
Get Product By Id
Get Product By Id
Get Product By Id
Get Product By Id
Get Product By Id
Get Product By Id
Get Product By Id
Get Product By Id
Get Product By Id

Thread 3 - Get All Products

Get Products
Get Products
Get Products
Get Products
Get Products
Get Products
Get Products
Get Products
Get Products
Get Products

我意识到我使用了一种非常糟糕的方法,我该如何实现呢?这就是我所做的:

【问题讨论】:

    标签: jmeter jmeter-5.0 jmeter-4.0


    【解决方案1】:

    建议使用 ONE 线程配置 TG,并使用循环(在 TG 内)连续执行请求,无论您需要什么请求。

    【讨论】:

    • TG?线程组?是的,但如果我使用循环,那么它将运行一个有 10 个用户的请求。不一样
    • 如前所述,线程组 (TG) 将仅配置为 ONE VUser 或线程,它将在循环中顺序执行 10 个请求。
    【解决方案2】:

    默认情况下,每个 JMeter 线程(虚拟用户)都会连续运行 Samplers(上下颠倒),因此您实际上不需要做任何事情来实现所需的行为。

    如果您希望第二个线程组在第一个线程组之后运行,第三个线程组在第二个线程组之后运行,等等,只需在Test Plan 级别上勾选Run Thread Groups consecutively 框:

    此外,您可能需要考虑使用 parameterizing 您的测试计划,即 CSV Data Set Config,这样您就不必复制和粘贴请求,而是为每个虚拟用户/迭代提供来自外部源的不同值

    【讨论】:

    • 我认为你没有理解我的意思。我也想在线程中一个一个地运行每个请求。在这种情况下我可以使用循环控制器吗?
    • 我认为您无法阅读/理解英语,每个线程都会颠倒执行采样器并一个接一个。
    • 我很抱歉造成误解。我也可以通过线程级别的循环计数来实现相同的行为吗?无需使用 CSV 数据集配置或无需复制和粘贴请求?
    • 无论你有多少个循环,一个或无限个循环,每个线程都会连续执行采样器
    • 是的,谢谢,我知道了,但是我可以使用循环计数而不是使用 CSV 数据集配置来复制请求吗?所以假设我需要在每个线程中运行 10 个采样器,我不能将循环计数设为 10 吗?
    猜你喜欢
    • 2016-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多