You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Knut Wuchtig <kn...@gmx.net> on 2008/10/27 17:21:41 UTC

Reading from Response

Hi,

i want to read something out of a response from a webservice test.

e.g. i'm looking for an ID like "abcd1234" on a response, 

after successfully read-out, i want to use this ID as a user defined
variable for the second step.

is this possible?


thanks in advance
knut
-- 
View this message in context: http://www.nabble.com/Reading-from-Response-tp20191070p20191070.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Reading from Response

Posted by Anthony Chadszinow <ac...@squiz.net>.
Hi Knut,

It sounds very possible.  Use a Regular expression post processor to 
extract the ID from the response and put it into a variable.  Then use 
the variable in the second step to help with your request.  See the 
manual, post processors - Regular Expression extractor for more information.

Chad

Knut Wuchtig wrote:
> Hi,
>
> i want to read something out of a response from a webservice test.
>
> e.g. i'm looking for an ID like "abcd1234" on a response, 
>
> after successfully read-out, i want to use this ID as a user defined
> variable for the second step.
>
> is this possible?
>
>
> thanks in advance
> knut
>   

-- 
Anthony Chadszinow
MySource Classic Lead Developer

Squiz
92 Jarrett St Leichhardt, Sydney NSW, Australia 2040 
t:    13000 SQUIZ ( Support )
t:    8507 9900 / 1300 130 661
f:    8507 9988
w:    www.matrix.squiz.net
w:    www.squiz.net

Sydney  |  Melbourne  |  Canberra  |  Hobart  |  Wellington  |  London 

Open Source  - Own it  -  Squiz.net 

----------------------------------------------------

IMPORTANT:This email (and any attachments) is commercial-in-confidence and
or may be legally privileged and must not be forwarded, copied or shared
without express permission from Squiz. If you are not the intended
recipient, you may not legally copy, disclose or use the contents in any way
and you should 
contact squiz@squiz.net immediately and destroy this message and any
attachments. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Building random string

Posted by sebb <se...@gmail.com>.
On 28/10/2008, Hiro Protagonist <hi...@googlemail.com> wrote:
> Hi all,
>
>  I have searched for a solution (or building blocks to a solution) to
>  this, but haven't found anything so far, and all my attempts to solve
>  this problem elegantly have failed - perhaps you can help...
>
>  I am trying to send a request, which contains within it some search
>  criteria, that can narrow down a search result when submitted.
>  Let's say, for argument's sake, there are 3 terms that can be used to
>  restrict what comes back. Any combination of these 3 terms can be used -
>  and herein lies the problem. I can, using a regex and random controller,
>  send a request that randomly picks from one of those 3 terms (by
>  creating 3 child requests of the random controller), but what I can't do
>  is pick a random COMBINATION of these values.
>
>  Furthermore, following the 'regex-and-random-controller' approach, I end
>  up having to manually create a request for each of the possible
>  combinations ( => cartesian product).
>  In case I haven't been clear, an example:
>
>  For a pet shop, you can display what kinds of aninmals you would like to
>  see, e.g. 'dog','cat','bird'.
>  I can randomise and send requests using either only dog, or only cat, or
>  only bird, but I can't figure out how to send requests for a random
>  combination of any of those three:
>
>  <criteria>DOG</criteria>
>
>  or
>
>  <criteria>DOG+CAT</criteria>
>
>  or
>
>  <criteria>DOG+CAT+BIRD</criteria>
>
>  I hope I have explained this sufficiently... Thanks for your help.

Is the list known in advance, or is it only known by extraction from a
previous result?

If the list is known in advance, then the easiest would be to write a
script to create a file containing all the combinations.

If you don't care if the criteria contain duplicates (e.g. DOG+CAT+DOG
or DOG+DOG+DOG et.) then just concatenate the 3 random selections - no
need for the random controllers.

Otherwise, you will have to write some code (jexl, javascript or
beanshell) to generate the criteria, in which case use the match-all
Regex feature.

Or it may be easier to write code to remove the duplicates from the
concatenation.

Something like:
- split string on '+'
- save unique values
- join values using '+'

If the order of items is not relevant then you can use a hash to
eliminate duplicates.
Otherwise you could use something like ListOrderedSet from Commons
Collections (JMeter already includes the collections jar).

If you use the Match-All Regex, then instead of splitting the string
you can read the variables in turn into a Hash or a Set as above.

>  Regards,
>  hiro
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Building random string

Posted by Hiro Protagonist <hi...@googlemail.com>.
Hi all,

I have searched for a solution (or building blocks to a solution) to
this, but haven't found anything so far, and all my attempts to solve
this problem elegantly have failed - perhaps you can help...

I am trying to send a request, which contains within it some search
criteria, that can narrow down a search result when submitted.
Let's say, for argument's sake, there are 3 terms that can be used to
restrict what comes back. Any combination of these 3 terms can be used -
and herein lies the problem. I can, using a regex and random controller,
send a request that randomly picks from one of those 3 terms (by
creating 3 child requests of the random controller), but what I can't do
is pick a random COMBINATION of these values.
Furthermore, following the 'regex-and-random-controller' approach, I end
up having to manually create a request for each of the possible
combinations ( => cartesian product).
In case I haven't been clear, an example:

For a pet shop, you can display what kinds of aninmals you would like to
see, e.g. 'dog','cat','bird'.
I can randomise and send requests using either only dog, or only cat, or
only bird, but I can't figure out how to send requests for a random
combination of any of those three:

<criteria>DOG</criteria>

or

<criteria>DOG+CAT</criteria>

or

<criteria>DOG+CAT+BIRD</criteria>

I hope I have explained this sufficiently... Thanks for your help.

Regards,
hiro


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


RE: Reading from Response

Posted by Jose Pablo Sarco <jo...@ar.neoris.com>.
Check the Regular Expression Extractor post processor for that:

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Reg
ular_Expression_Extractor

Regards,

Jose



-----Original Message-----
From: Knut Wuchtig [mailto:knutwu@gmx.net] 
Sent: Lunes, 27 de Octubre de 2008 02:22 p.m.
To: jmeter-user@jakarta.apache.org
Subject: Reading from Response


Hi,

i want to read something out of a response from a webservice test.

e.g. i'm looking for an ID like "abcd1234" on a response, 

after successfully read-out, i want to use this ID as a user defined
variable for the second step.

is this possible?


thanks in advance
knut
-- 
View this message in context:
http://www.nabble.com/Reading-from-Response-tp20191070p20191070.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org

#################################################################################################################
Este documento puede incluir informaci�n confidencial y propiedad de Neoris y deber� ser le�do solamente por la 
o las personas a quienes est� dirigido. Si usted ha recibido este mensaje por error, por favor avise 
inmediatamente al remitente contestando y eliminando este correo. Cualquier punto de vista u opiniones expresadas 
en este mensaje son del remitente y no necesariamente coinciden con aquellas de Neoris. Este documento no deber� 
ser reproducido, copiado, distribuido, publicado, ni modificado por terceros sin la autorizaci�n por escrito de Neoris. 

Este mensaje ha sido verificado contra virus. Vis�tenos en www.neoris.com. 



This document may include proprietary and confidential information of Neoris, and may only be read by those 
person or persons to whom it is addressed. If you have received this e-mail message in error, please advise 
the sender immediately by reply e-mail and delete this message. Any views or opinions expressed in this e-mail 
are those of the sender and do not necessarily coincide with those of Neoris. This document may not be reproduced,
copied, distributed, published, modified or furnished to third parties, without the prior written consent of 
Neoris.

This e-mail message has been scanned for viruses and cleared. Visit us at www.neoris.com
##################################################################################################################

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org