HomeSUPPORT QUESTIONS

Need help with StresStimulus? Start here.

Matching Random Extractors Messages in this topic - RSS

sachpatel
sachpatel
Posts: 11


17 days ago
sachpatel
sachpatel
Posts: 11
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: 401


16 days ago
George @StresStimulus
George @StresStimulus
Administrator
Posts: 401
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: 11


15 days ago
sachpatel
sachpatel
Posts: 11
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: 401


15 days ago
George @StresStimulus
George @StresStimulus
Administrator
Posts: 401
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 © 2021 Stimulus Technology