【问题标题】:In JMETER - How to achieve TPS at each individual request level for API testing在 JMETER 中 - 如何在每个单独的请求级别实现 TPS 以进行 API 测试
【发布时间】:2019-08-19 01:47:47
【问题描述】:
I would like to achieve transactions per minutes at request level, what would be approach and how the script structure should look like ?

要求:

我总共有 67 个并发用户。

I need to achieve transaction per minute at each request level, all under same thread group. As per my requirement, my each HTTP sampler is a transaction. This is for API testing.

6 API requests under 6 simple controller. 

My Script structure:
1. Test Plan
2. Thread Group
3. Simple Controller
    i. HTTP Sampler
    ii. Response Assertion.
    iii. Boundary value Extractor
    iv. Results Action Set Handler
4. View Results Tree
5. Summary Report

I have tried 2 ways:

Instead of simple controller, i have used throughput controller and used percent Executions.

I also had constant throughput timer.

Requirement:
In total i have 67 concurrent users.

I need to achieve transaction per minute at each request level, all under same thread group.

6 API requests under 6 simple controller.

My Script structure:

1. Test Plan
2. Thread Group
3. Simple Controller
    i. HTTP Sampler
    ii. Response Assertion.
    iii. Boundary value Extractor
    iv. Results Action Set Handler
4. View Results Tree
5. Summary Report

Example:    
All API requests / http sampler falls under the same thread group and request should execute in the given sequence as correlation is in place.

API 请求 1 - 每分钟 152 个请求。 API 请求 2 - 每分钟 56 个请求。 API 请求 3 - 每分钟 32 个请求。 API 请求 4 - 每分钟 12 个请求。 API 请求每分钟 5 - 12 个请求。 API 请求每分钟 6 - 12 个请求。

Were i need to perform a load test and soak test as well with the above workload model.

【问题讨论】:

    标签: transactions jmeter httprequest throughput jmeter-4.0


    【解决方案1】:

    在同一 Thread Group 下,不同的 Samplers 不能有不同的吞吐量级别,因为 JMeter 颠倒执行采样器并循环,因此总执行速度将被限制为最慢采样器的执行速率。

    解决方案是将要以不同速度执行的请求放在不同的线程组下。如果您需要在不同线程组中的线程之间传递值,您可以使用:

    1. __setProperty() function 在第一个线程组中将所需的值保存到 JMeter 属性中,__P() function 在第二个线程组中读取值。您可能还想将它与__threadNum() function 结合使用以使值特定于线程。
    2. Inter-Thread Communication Plugin

    反过来,您可以使用以下测试元素之一为不同线程组下的采样器设置所需的 TPS:

    1. Constant Throughput Timer
    2. Precise Throughput Timer
    3. Throughput Shaping Timer

    【讨论】:

    • 谢谢 Dmitri :) 你的回答很清楚。
    猜你喜欢
    • 2019-04-02
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多