How to make 123456789 from image as a dynamic variable in Jmeter

163 views Asked by At

I have my XML Body data (attached screenshot below),

From screenshot you can see value 123456789 in Signature.

I'm looking to make 123456789 a dynamic variable value, So that JMeter automatically gets that value from server whenever I run script.

I'm looking something like Regular expression extractor but for SOAP request.

1

2

There are 2 answers

5
Ori Marko On

You can add Regular Expression Extractor with values:

Reference Name: aSignature

Regular expression: (\d+)</aSignature> 

Template: $1$ 

Match No: 1 

You'll get First match of all numbers before aSignature end tag.

It'll save value in a variable you can use later as ${aSignature} (or vars.get("aSignature") in JSR223 component)

Using Regular expression is better than using XPath according to jmeter mailing, ubik and testautomationguru.

3
Dmitri T On
  1. Add XPath Extractor as a child of your request
  2. Configure it as follows:

    • Reference Name: anything meaningful, i.e. signature
    • XPath Expression: //*[local-name()='aSignature']/text()
  3. Refer the extracted value as ${signature} where required.

References: