Jmeter : How to increment a value inside the request

谁都会走 提交于 2019-12-23 12:44:28

问题


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.


回答1:


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

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



回答2:


Use Counter. Starts wìth 00089312121 Increment by 1 save in Reference Name cnt and Number Format 00000000

Inside your request call it with prefix:

  TID-2153656-${cnt}


来源:https://stackoverflow.com/questions/45821446/jmeter-how-to-increment-a-value-inside-the-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!