0

I have a page that returns a set of catalog ids in the following format:

addCatentryId('445653', '23151', 'csb_RVI_10053');

I am trying to separate each of the above values into an array for further evaluation.

Based on suggestions in another post in this forum, a two step approach was recommended:

1) Use the first regular expression extractor to retrieve the data segment above from the page response data

2) Execute a follow-up Regular Expression extractor against the results of the first data extract to convert the string data into an array of usable values.

To this end, I have setup the following extractors in my JMeter script:

Extractor 1: Jmeter Regular Expression Extractor 1

Extractor 2: Jmeter Regular Expression Extractor 2

When I execute the above, I get the following results, which I am not sure how to interpret, but it appears that the catEntryIDString is being found, but for some reason is not being fed to the second regular expression process:

JMeterVariables:
JMeterThread.last_sample_ok=true
JMeterThread.pack=org.apache.jmeter.threads.SamplePackage@41035d67
START.HMS=073225
START.MS=1479126745560
START.YMD=20161114
TESTSTART.MS=1479129860911
__jmeter.USER_TOKEN__=Place User Order 1-1
arrValItemId= <---- Why is this empty?
catEntryIDString=null <--- should this be null?
catEntryIDString_g=0
catEntryIDString_g0=addCatentryId('460734', '12220', 'csb_RVI_10053'); <-- data appears to be getting retrieved by 1st extractor

Any help would be greatly appreciated, as Google Search turns up no useful information, and the BlazeMeter help pages for JMeter do not go into this much detail (at least based on my information searches of that site).

Thanks in advance!!

Caelaran
  • 45
  • 2
  • 9

1 Answers1

0

you don't need two regular expression extractors to capture multiple values from single response. we can use Template to capture multiple values by specifying multiple groups using () i.e., parenthesis.

Try the following regular expression:

addCatentryId\('(.*?)', '(.*?)', '(.*?)'\);

Following is image reference: enter image description here

Once you capture all three values into Reference Name called AllValues (in the example image), then we can access each group/value as follows:

first group - AllValues_1_g1 (which yields 445653) second group - AllValues_1_g2 (which yields 23151) third group - AllValues_1_g3 (which yields csb_RVI_10053)

Image reference: enter image description here

If you want to refer any captured valule in subsequent requests, we use the following syntax in JMeter:

${reference_name}

eg:

${AllValues_1_g1} - to use 445653 value.

Reference:

  1. https://stackoverflow.com/a/39547786/2575259
Community
  • 1
  • 1
Naveen Kumar R B
  • 6,248
  • 5
  • 32
  • 65