Is this a json string or a custom format?. If custom then parse the string
in java and use vars.put in your beanshell pre processor. If json then there
are available parse rs to convert to java objects that can be looped over.
You could also use regex plus some java loops
On Apr 15, 2011 1:15 AM, "Nermin CALUK" <ner...@atlantbh.com> wrote:
> Hi,
>
> I have a response in JMeter that looks like this:
>
> {NO_RECS_PROC=12, NO_RECS_PASS=11, NO_RECS_FAIL=1, BYTES_READ=193}
>
> i.e. pairs of "names" and "values". However, response in the brackets may
> vary in terms of different names and number of items that appear inside
and
> even their order. Using regex extractor [{| ](.+?)=(.+?)[,|}] I can
extract
> each variable name (ex BYTES_READ) and each value (193) and they are
stored
> in groups, for example extr_4_g1=BYTES_READ and extr_4_g2=193
>
> How can I create JMeter variables on the fly (${BYTES_READ}) and assign it
> corresponding value (193)? I want to avoid working with regex extracted
> group variables (example: extr_4_g1) and I want to get more human readable
> variables (example: BYTES_READ) to avoid any mistakes. The final result
> should be, in this example, 4 JMeter variables (${NO_RECS_PROC}
> ${NO_RECS_PASS} etc), corresponding values being assigned to them (12 11
> etc), so I can use those human readable variables for further assertions
> etc.
>
> I have tried using Beanshell (loop that goes around as many times as there
> are groups, vars.put, evalVar...) but no success because I'm not sure how
to
> do this on the fly. I.e. I tried lopping "extr_X_g1" where X ranges from 1
> (first group) to the number of groups (this case 4) and using vars.put but
> doesn't work probably because I was trying to nest JMeter's __evalVar${}
in
> Beanshell command...
>
> There must be a more elegant way to do this :) I'd appreciate if someone
can
> help.
>
> Thanks,
> Nermin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
>