0
votes

In my first request I am able to extract the value using Regular Expression Extractor which is clearly visible into the debug sampler. The value is extracted by setting the following options in Regular Expression Extractor:-

Name of Created Variable:- instanceUID 
Regular Expression:- "InstanceUid":"(.*?)"
Template:-$1$
Match No:-1
Default Value:- (Blank)

The value that I want to pass in the next POST request is visible as:-

instanceUID_g1=2ab5dfb8-a217-4ff2-9025-523565b7b7ad

And the body for the next HTTP POST request is set like this:-

${"iInfo":{"InstanceUid":"${instanceUID_g1}","Registry":"${Registry}"}}

When this request seen in detail inside View Results Tree looks like:-

${"iInfo":{"InstanceUid":"${instanceUID_g1}","Registry":"AAX"}}

As seen the value of ${instanceUID_g1} did not get substituted in the POST body as was for variable ${Registry} which was taken from CSV config. Being new to Jmeter can anyone suggest what did I miss?

1

1 Answers

0
votes

Most probably your Regular Expression Extractor placement is not very correct, be informed about JMeter Scoping Rules concept

  • If you place Regular Expression Extractor as a child of the request - it will be applied to this request only

    enter image description here

  • If you place Regular Expression Extractor at the same level as several requests - it will be applied to all of them

    enter image description here

in the latter case it will be applied 1st to 1st sampler, then to Debug Sampler, then to 3rd sampler so on 2nd step it will be overwritten, most probably that's your problem

Also it appears that you're getting the data from JSON so it makes more sense to use JSON Extractor or JMESPath Extractor