jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guru <praumes...@gmail.com>
Subject Re: Is possible extract a group of values with Regular Expression extractor?
Date Wed, 28 Aug 2013 00:15:14 GMT
I see what Regular expression was doing.
For example, lets say i have the following response:
<ns10:UserRowId="1"><ns6:UserId>ffffffff521cf326e4b05c028a28007d</ns6:UserId><ns6:FirstName>1aug2713</ns6:FirstName><ns6:LastName>1aug2713</ns6:LastName><ns6:Gender>Unspecified</ns6:Gender><ns6:UserName>1aug2713</ns6:UserName><ns6:Password>password1</ns6:Password><ns6:EncryptionType>SHA</ns6:EncryptionType><ns6:AuthenticationType>SSO</ns6:AuthenticationType><ns6:BusinessRuleSet>CG</ns6:BusinessRuleSet><ns6:AutoGenerated>false</ns6:AutoGenerated></ns10:User>
<ns10:UserRowId="2"><ns6:UserId>ffffffff521cf326e4b05c028a28007e</ns6:UserId><ns6:FirstName>2aug2713</ns6:FirstName><ns6:LastName>2aug2713</ns6:LastName><ns6:Gender>Unspecified</ns6:Gender><ns6:UserName>2aug2713</ns6:UserName><ns6:Password>password1</ns6:Password><ns6:EncryptionType>SHA</ns6:EncryptionType><ns6:AuthenticationType>SSO</ns6:AuthenticationType><ns6:BusinessRuleSet>CG</ns6:BusinessRuleSet><ns6:AutoGenerated>false</ns6:AutoGenerated></ns10:User>
<ns10:UserRowId="3"><ns6:UserId>ffffffff521cf326e4b05c028a28007f</ns6:UserId><ns6:FirstName>3aug2713</ns6:FirstName><ns6:LastName>3aug2713</ns6:LastName><ns6:Gender>Unspecified</ns6:Gender><ns6:UserName>3aug2713</ns6:UserName><ns6:Password>password1</ns6:Password><ns6:EncryptionType>SHA</ns6:EncryptionType><ns6:AuthenticationType>SSO</ns6:AuthenticationType><ns6:BusinessRuleSet>CG</ns6:BusinessRuleSet><ns6:AutoGenerated>false</ns6:AutoGenerated></ns10:User>
My Regular expression extractor is as follow:
Reference Name: username
Regular Expression:
<ns6:UserId>(.+?)</ns6:UserId>.*<ns6:UserName>(.+?)</ns6:UserName>
Template: $1$ $2$
Match No.= 1
 The value that is being saved on my txt file that I mentioned is like this.
ffffffff521cf326e4b05c028a28007d,3aug2713
So, it is saving the first userId and the last Username.
When I tried -1, on my txt file it is saving null.
Just to do some more research on it, I changed my regular expression as
below and I also added debug sampler
Reference Name: username
Regular Expression: <ns6:UserId>(.+?)</ns6:UserId
Template: $1$
Match No.= -1
When I look at debug Sampler Response data with above configuration I see
it is extracting all three UserId and I changed the jmeter.property file as
sample_variables=username_1,username_2,username_3
This let me save all 3 userId in a file i have mentioned. But the issue is
If i have 500 UserId, do I have to mention all 500 in property file. I have
tried
sample_variables=username_n but the value that got saved in a file is null.
JMeterVariables:
JMeterThread.last_sample_ok=true
JMeterThread.pack=org.apache.jmeter.threads.SamplePackage@1ed2e55e
START.HMS=163623
START.MS <http://start.ms/>=1377646583923
START.YMD=20130827
TESTSTART.MS <http://teststart.ms/>=1377647571490
username_1=ffffffff521cf326e4b05c028a28007d
username_1_g=1
username_1_g0=<ns6:UserId>ffffffff521cf326e4b05c028a28007d</ns6:UserId>
username_1_g1=ffffffff521cf326e4b05c028a28007d
username_2=ffffffff521cf326e4b05c028a28007e
username_2_g=1
username_2_g0=<ns6:UserId>ffffffff521cf326e4b05c028a28007e</ns6:UserId>
username_2_g1=ffffffff521cf326e4b05c028a28007e
username_3=ffffffff521cf326e4b05c028a28007f
username_3_g=1
username_3_g0=<ns6:UserId>ffffffff521cf326e4b05c028a28007f</ns6:UserId>
username_3_g1=ffffffff521cf326e4b05c028a28007f
username_matchNr=3
2n Question, I am trying to extract not only userId but the corresponding
Username of the UserId. So, when I have my regular expression as below:
Regular Expression:
<ns6:UserId>(.+?)</ns6:UserId>.*<ns6:UserName>(.+?)</ns6:UserName>
it is extracting the first userId and the last username. What would be the
right Reg Ex expression to extract all of them.


On Tue, Aug 27, 2013 at 5:07 PM, Flavio Cysne [via JMeter] <
ml-node+s512774n5717999h29@n5.nabble.com> wrote:

> Match number -1 return all matches under the pattern
> <variableName>_<matchIndex>_g<groupNumber>
> The total number of matches is available in <variableName>_matchNr
> variable
>
> Example: variableName = myVar
> ${myVar} will return default value or null if none was defined
> ${myVar_1_g1} will return the first match of the first group
> ${__V(myVar_${myVar_matchNr}_g1)} will return the value of the last match
> of the first group
>
>
> 2013/8/27 guru <[hidden email]<http://user/SendEmail.jtp?type=node&node=5717999&i=0>>
>
>
> > I have tried match No: -1 but it gives null. It is not extracting all
> the
> > possible matches.
> >
> > Regular
> >
> >
> Expression:<ns6:UserId>(.+?)</ns6:UserId>.*<ns6:UserName>(.+?)</ns6:UserName>
>
> > Template: $1$ $2$
> > Match No: -1
> > Default Value:
> >
> >
> >
> > --
> > View this message in context:
> >
> http://jmeter.512774.n5.nabble.com/Is-possible-extract-a-group-of-values-with-Regular-Expression-extractor-tp531174p5717997.html
> > Sent from the JMeter - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5717999&i=1>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5717999&i=2>
> >
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://jmeter.512774.n5.nabble.com/Is-possible-extract-a-group-of-values-with-Regular-Expression-extractor-tp531174p5717999.html
>  To unsubscribe from Is possible extract a group of values with Regular
> Expression extractor?, click here<http://jmeter.512774.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=531174&code=cHJhdW1lc2g4NkBnbWFpbC5jb218NTMxMTc0fDEzMzMxOTQyMTg=>
> .
> NAML<http://jmeter.512774.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://jmeter.512774.n5.nabble.com/Is-possible-extract-a-group-of-values-with-Regular-Expression-extractor-tp531174p5718000.html
Sent from the JMeter - User mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message