vishi
vishi

Reputation: 17

Jmeter how to get the dynamic parameter value in the path

JMeter path contents some dynamically generated value. Eg

[HTTP Request]
[path-home/user?p=er3562]

This "p" value is dynamically generated. I want to get this parameter value in the first HTTP request path. This parameter value should pass through each HTTP request path.

I am new to JMeter. Please help me to solve this?

Upvotes: 1

Views: 2941

Answers (2)

Dmitri T
Dmitri T

Reputation: 168002

You need to extract it somehow and convert into a JMeter Variable for later reuse. JMeter provides several PostProcessors for extracting data from different responses types, in your case the most suitable one will be Regular Expression Extractor.

  1. Add Regular Expression Extractor as a child of the request which returns that path-home/user?p=er3562 value
  2. Configure it as follows:

    • Apply to: depending on where the "interesting" value lives, the most "safe" setting is Main sample and sub-samples
    • Field to check: depending on where the "interesting" value comes from, in the majority of cases it's Body but in your case it may be i.e. URL
    • Reference Name: anything meaningful, it is JMeter Variable name, if JMeter finds anything it will store the result in a variable named accordingly to this field. I.e. path-home
    • Regular Expression: Perl5-style regular expression, in your case it would be something like: path-home/user\?p=er(\d+)
    • Template: if you're looking to extract a single value it will be $1$
  3. Refer extracted value as ${path-home} where required.

References and tips:

Upvotes: 1

Vinod
Vinod

Reputation: 2311

By using correlation concept , regular expression extractor concept & try this key p=er(.*?)

Upvotes: 0

Related Questions