Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jmeter : How to increment a value inside the request

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.

like image 705
daitha shankar Avatar asked Aug 22 '17 15:08

daitha shankar


People also ask

What is the use of counter in JMeter?

What Is a Counter in JMeter? A counter in JMeter is an element that allows you to generate an incremental value. This allows you to reference the value from anywhere within a thread group.

What is specify thread lifetime in JMeter?

Specify Thread lifetime If selected, confines Thread operation time to the given bounds. Duration (seconds) If the scheduler checkbox is selected, one can choose a relative end time. JMeter will use this to calculate the End Time.


2 Answers

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

${__intSum(${id},1,id)}
like image 165
v0devil Avatar answered Oct 03 '22 06:10

v0devil


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}
like image 37
user7294900 Avatar answered Oct 03 '22 06:10

user7294900