jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nermin CALUK" <ner...@atlantbh.com>
Subject How to map extracted pairs of var. names and var. values on the fly
Date Fri, 15 Apr 2011 08:14:25 GMT
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-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message