HomeSUPPORT QUESTIONS

Need help with StresStimulus? Start here.

Matching Random Extractors Messages in this topic - RSS

sachpatel
sachpatel
Posts: 12


7/12/2021
sachpatel
sachpatel
Posts: 12
Hi,

I had the following query. When obtaining two extractors from the same request (for example, ext_ID and ext_name). The occurrence type is set to random. The extractors cannot be combined. How can I link the random extractor that is selected for the ID and is linked with the ext_name, i.e. the random index value is the same for both extractors?

Thank you.

Regards,
Sachin
0 link
George @StresStimulus
George @StresStimulus
Administrator
Posts: 554


7/13/2021
George @StresStimulus
George @StresStimulus
Administrator
Posts: 554
It sounds like you want to create 2 extractors with the same random occurrence. The way to accomplish this is to create the following 2 extractors:
  • An extractor with a random occurrence to extract an ID.
  • A dynamic extractor with the first occurrence that has the extracted value of the first extractor in the definition.

I don’t know how your response looks but for example let’s say you have a json response as follows:

[
{
“id”: 1,
“name”: “Mike”
},
{
“id”: 2,
“name”: “Sally”
},
{
“id”: 3,
“name”: “April”
}
]

You can create 2 extractors as follows:
  • Regular expression extractor named ID and random occurrence with the following definition: “id”(\d+)
  • Jpath dynamic extractor named Name with first occurrence with following definition: $.[?(@.id =={{ID}}].name
0 link
sachpatel
sachpatel
Posts: 12


7/14/2021
sachpatel
sachpatel
Posts: 12
Hi George,

Thank you for the response. I followed the steps. However, the dynamic extractor is not returning a value. The below provides more detail:

Extractor 1: ext_purposeId (Regular Expression) - This extracts the fos_purposeid from a previous request (to the one below).
Extractor 2: ext_purposeName (Dynamic extractor, first occurrence). $.[?(@.fos_purposeid == {{ext_purposeId}}].fos_name

JSON snippet
"fos_purposeid":"851a66af-be0e-eb11-a813-0022481ae203","fos_name":"ADR highly complex notice - s75 Covid-affected (bulk)"


Is there something wrong with that?
0 link
George @StresStimulus
George @StresStimulus
Administrator
Posts: 554


7/15/2021
George @StresStimulus
George @StresStimulus
Administrator
Posts: 554
Thanks for letting me know.

The jpath query looks good, however, I don’t know exactly how your response json looks like to verify that your query is accurate.

One thing I can think of, since you are creating a dynamic extractor, make sure to set the Is the extractor dynamic? property to Yes



Also, make sure you are using StresStimulus v5.4 as dynamic jpath extractors were added in that version.

- Cheers
0 link






Copyright © 2024 Stimulus Technology