0

I have a http request which gives json output as :

{
"MESSAGE_CODE":200,
"MESSAGE_DESCRIPTION":"OTP Generated Successfully",
"data":
{
"otp":"123456",
"otpGeneratedDate":"yyyy-mm-dd"
}
}

I want to use otp as the input parameter in json for my next http request.

I have added JSON extractor with following configuration :

enter image description here

Names of created variable : OTP JSON path expressions : $..data.otp Match No. : 1

But still when I am calling this parameter as

"otpNumber": "${OTP}" in my next input JSON http request, its not getting called. and value is passed as ${OTP} for otpNumber

How can I handle this

Narendra
  • 1,511
  • 1
  • 10
  • 20

1 Answers1

0

As per JMeter Documentation:

Variables, functions (and properties) are all case-sensitive

So you need to change this line:

"otpNumber": "${OTP}"

to this one:

"otpNumber": "${otp}"

and your test should start working as expected.

You can observe which JMeter Variables are defined along with their values using Debug Sampler and View Results Tree listener combination.

enter image description here

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Tried that also. Issue here is that I am trying to use that variable in another thread. Is it possible? – Mehul Jain Mar 07 '19 at 09:33
  • You cannot use JMeter Variables defined in one Thread Group in another Thread Group. You will either need to convert it into a JMeter Property using [__setProperty() function](https://jmeter.apache.org/usermanual/functions.html#__setProperty) in one Thread Group and refer it using [__P() function](https://jmeter.apache.org/usermanual/functions.html#__P) in another one or go for [Inter-Thread Communication Plugin](https://www.blazemeter.com/blog/how-to-use-the-inter-thread-communication-plugin-in-jmeter) – Dmitri T Mar 07 '19 at 10:01