Jmeter:如何在请求内增加一个值 [英] Jmeter : How to increment a value inside the request

查看:150
本文介绍了Jmeter:如何在请求内增加一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像波纹管这样的样品请求

{
  "schema": "urn:com.xyx9723.syodhnc:bulk.v1",
  "version": "7-06-26201",
  "msg": [
    {
      "topic": "tags/kdhud/${ID}/sadknnf",
      "ids": [
        {
          "_time": "2107-09-09 13:13:12",
          "id": "TID-2153656--00089312121"
        },
        {
          "_time": "2107-09-09 13:13:12",
          "id": "TID-2153656-00089312122"
        },
        {
          "_time": "2107-09-09 13:13:12",
          "id": "TID-2153656-00089312123"
        },
        {
          "_time": "2107-09-09 13:13:12",
          "id": "TID-2153656-00089312124"
        }
      ]
    }
  ]
}

在实际测试中,我必须发送带有增量值的100个IDS的请求,例如(TID-2153656--00089312121,TID-2153656--00089312122,TID-2153656--00089312123 ....等)

在JMeter中发送请求时如何在请求中赋予增量值.

解决方案

初始化某个地方的变量id,然后在请求中多次使用它,它将在每次发生时增加值:

${__intSum(${id},1,id)}

I have a sample request like a bellow

{
  "schema": "urn:com.xyx9723.syodhnc:bulk.v1",
  "version": "7-06-26201",
  "msg": [
    {
      "topic": "tags/kdhud/${ID}/sadknnf",
      "ids": [
        {
          "_time": "2107-09-09 13:13:12",
          "id": "TID-2153656--00089312121"
        },
        {
          "_time": "2107-09-09 13:13:12",
          "id": "TID-2153656-00089312122"
        },
        {
          "_time": "2107-09-09 13:13:12",
          "id": "TID-2153656-00089312123"
        },
        {
          "_time": "2107-09-09 13:13:12",
          "id": "TID-2153656-00089312124"
        }
      ]
    }
  ]
}

When it comes to real test I have to send request with 100 IDS with increment values like (TID-2153656--00089312121, TID-2153656--00089312122, TID-2153656--00089312123 .... etc)

How to give incremental value in the request while sending a request in JMeter.

解决方案

Initialize somewhere variable id and then use it inside request several times, it will increase value with every occur:

${__intSum(${id},1,id)}

这篇关于Jmeter:如何在请求内增加一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆