or What is the other way of saving them beside sample_variable feature
On Tue, Aug 27, 2013 at 5:29 PM, umesh prajapati <[email protected]>wrote: > Thank you for the tips ".*?" > > So, where can I defind username_n. so I dont have to write username_1, > username_2.............................username_500 (500 times) > > > On Tue, Aug 27, 2013 at 5:16 PM, sebb <[email protected]> wrote: > >> On 28 August 2013 01:03, umesh prajapati <[email protected]> wrote: >> > Hi Sebb, >> > >> > 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> >> >> The ".*" in the middle of the RE is greedy; it will match as much as >> possible. >> Use ".*?" instead. >> >> > 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. >> >> See above; the RE has a greedy middle. >> >> > 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. >> >> Yes, if you want to save them using the sample_variables feature. >> >> > I have tried sample_variables=username_n but the value that got saved >> in a file is null. >> >> Yes, because the variable username_n is not defined. >> >> > JMeterVariables: >> > JMeterThread.last_sample_ok=true >> > JMeterThread.pack=org.apache.jmeter.threads.SamplePackage@1ed2e55e >> > START.HMS=163623 >> > START.MS=1377646583923 >> > START.YMD=20130827 >> > 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. >> >> See above. >> >> > >> > >> > >> > >> > >> > On Tue, Aug 27, 2013 at 2:44 PM, umesh prajapati <[email protected] >> >wrote: >> > >> >> Ignore my comment about Match No = 1 because I only have one main >> sample. >> >> >> >> According to Jmeter documentation: >> >> >> >> Indicates which match to use. The regular expression may match multiple >> >> times. >> >> >> >> - Use a value of zero to indicate JMeter should choose a match at >> >> random. >> >> - A positive number N means to select the nth match. >> >> - Negative numbers are used in conjunction with the ForEach >> controller >> >> - see below. >> >> >> >> i have tried 0 and still extract the last match, I have tried 1 and >> still >> >> extract the last match, and any number beside 1 and 0 gives null. >> >> >> >> >> >> On Tue, Aug 27, 2013 at 2:14 PM, umesh prajapati <[email protected] >> >wrote: >> >> >> >>> If the match number is set to a negative number, then all the possible >> >>> matches in the sampler data are processed. The variables are set as >> follows: >> >>> >> >>> >> >>> - refName_matchNr - the number of matches found; could be 0 >> >>> - refName_n, where n = 1,2,3 etc - the strings as generated by the >> >>> template >> >>> - refName_n_gm, where m=0,1,2 - the groups for match n >> >>> - refName - always set to the default value >> >>> - refName_gn - not set >> >>> >> >>> I am not understanding this.. an example on how to extract all matches >> >>> would be great >> >>> >> >>> >> >>> On Tue, Aug 27, 2013 at 1:37 PM, umesh prajapati < >> [email protected]>wrote: >> >>> >> >>>> So, in my case Match No. = 1 because I only have one main sample. >> >>>> >> >>>> But this is not extracting all 500 userId and corresponding username >> but >> >>>> instead just extracting one userId and corresponding username >> >>>> >> >>>> >> >>>> On Tue, Aug 27, 2013 at 1:11 PM, sebb <[email protected]> wrote: >> >>>> >> >>>>> On 27 August 2013 19:58, umesh prajapati <[email protected]> >> wrote: >> >>>>> > My response will be as below: >> >>>>> > >> >>>>> > >> >>>>> > >> >>>>> >> <ns10:BatchInfo><ns10:BatchId>PSN_1</ns10:BatchId></ns10:BatchInfo><ns10:BatchStatus>Complete</ns10:BatchStatus><ns10:UsersStatus="Success"Count="3"> >> >>>>> > <ns10:User >> >>>>> >> RowId="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: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: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></ns10:Users></ns10:GetUserBatchStatusResponse></soapenv:Body></soapenv:Envelope> >> >>>>> > ...... >> >>>>> > ......... >> >>>>> > .... >> >>>>> > <ns10:RowID="500"><ns6:UserId>........... >> >>>>> > >> >>>>> > >> >>>>> > So, I would like to extract all 500 userId and corresponding >> Username >> >>>>> to it >> >>>>> > and save it on a file like this: >> >>>>> > ffffffff521cf326e4b05c028a28007d,1aug2713 >> >>>>> > ffffffff521cf326e4b05c028a28007e,2aug2713 >> >>>>> > ffffffff521cf326e4b05c028a28007f,3aug2713 >> >>>>> > ............. >> >>>>> > .......... >> >>>>> > ..... >> >>>>> > >> >>>>> > >> >>>>> > In my regular expression extractor this is what I have so far: >> >>>>> > >> >>>>> > Regular Expression: >> >>>>> > <ns6:UserId>(.+?)</ns6:UserId>.*<ns6:UserName>(.+?)</ns6:UserName> >> >>>>> > Template:$1$ $2$ >> >>>>> > Match No.(0 for Random): (what should i put here to extrat all >> >>>>> matching) >> >>>>> >> >>>>> >> >>>>> >> http://jmeter.apache.org/usermanual/component_reference.html#Regular_Expression_Extractor >> >>>>> >> >>>>> See the description of Match No. >> >>>>> >> >>>>> > Default Value: >> >>>>> >> >>>>> >> --------------------------------------------------------------------- >> >>>>> To unsubscribe, e-mail: [email protected] >> >>>>> For additional commands, e-mail: [email protected] >> >>>>> >> >>>>> >> >>>> >> >>> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >
