[Tsung] question on regexp for dyn_variables

thierry.coutaz at fr.thalesgroup.com thierry.coutaz at fr.thalesgroup.com
Thu Jan 14 09:50:02 CET 2010


For the regexp expression, I believe you can try :

setCachedSessionKey(.\(.*\).)

where (see regexp documentation) :
. meens "any character"
* means 0 to n occurence of preceeding character
( is the parenthesis of your response string
\( and \) are regexp controlers that allow you to define a field (ie the
string you will get in you dynvar)


your tsung script should look like this :

<match do="log" when="match">setCachedSessionKey(.\(.*\).)</match>



> -----Message d'origine-----
> De : tsung-users-bounces at lists.process-one.net
> [mailto:tsung-users-bounces at lists.process-one.net]De la part de Craig
> Jolicoeur
> Envoyé : mercredi 13 janvier 2010 21:23
> À : tsung-users at lists.process-one.net
> Objet : [Tsung] question on regexp for dyn_variables
> 
> 
> I'm a little unclear on the proper syntax for matches and
> dyn_variables using regexp expressions with tsung.
> 
> The documentation gives an example of:
> 
> <request> <dyn_variable name="mytitlevar"
> regexp="&lt;title&gt;\(.*\)&lt;/title&gt;"/> <http
> url="/testtsung.html" method="GET" version="1.0"></http>
> </request>
> 
> 
> I'm unsure why the regexp is in the format it is.  For instance, why
> are the match characters (the parenthesis) escaped with a backslash.
> Wouldn't that mean to search for the literal parenthesis character
> instead of using the paren as a match object?
> 
> Also, when trying to do a <match> on the server response, the
> documentation does not say how to match against a regexp instead of a
> standard string.  The docs simply say you can use a regexp, but what
> is the syntax for doing so?  Do I do something like:
> 
> <match do="log" when="match">/regexp_here/</match>
> 
> Or what is the actual syntax?
> 
> I'm unable to figure this out.
> 
> I'm trying to match the following server response:
> 
> setCachedSessionKey('1234abcd')
> 
> to grab the session key value.
> 
> I've tried the following regexp and none seem to work
> 
> SessionKey\('(.*)'\)
> 
> SessionKey.{2}(.*).{2}
> 
> SessionKey.{2}\(.*\).{2}
> 
> What am I doing wrong?
> 
> - Craig
> _______________________________________________
> Tsung-users mailing list
> Tsung-users at lists.process-one.net
> https://lists.process-one.net/mailman/listinfo/tsung-users
> 


More information about the Tsung-users mailing list