---------- Forwarded message ---------- From: praveen <[EMAIL PROTECTED]> Date: Tue, 23 Nov 2004 18:05:02 -0600 Subject: Re: nesting constants/variables between two groups in template To: sebb <[EMAIL PROTECTED]>
Thanks for the detailed explanation Kyle. The Match No. I use is "1", with the expectation that the first match that is found is considered. But I still get the result of the 1st group, the 3rd group, and only then, the nested constant at the end like I described earlier. Here's the structure of my XML USER PARAMETERS BASE_URL = "/g-control/gocentura.gx/" HTTP Request Regex for editionURL Reference name = editionURL Regular Expression = (action=")(.*\.gx)(.*changeEdition\/)([^"]+) Template = $3$${EditionID}/$4$ Match No. = 1 Default Value = null Regex for EditionID Reference name = EditionID Regular Expression = (<option value=")(\d+)("[^>\s]*>\w\w<\/option>) Template = $2$ Match No. = 0 Default Value = null If Controller "${VAR1}" == "null Invalid HTTP Request // so that thread stops If Controller "${VAR2}" == "null Invalid HTTP Request // so that thread stops HTTP Request PATH = ${BASE_URL}/${editionURL} The log output for jmeter.extractor.RegexExtractor and jmeter.protocol.http.sampler.HTTPSampler is below: 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: Pattern = [EMAIL PROTECTED] 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: template = $2$ 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: template split into 2 pieces, starts with = true 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor processing result 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: Regex = (<option value=")(\d+)("[^>\s]*>\w\w<\/option>) 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Match found! 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Match found! 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Match found! 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Template piece #0 = 2 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Template piece #1 = 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Template piece #2 = 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: Regex Extractor result = 493 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: Pattern = [EMAIL PROTECTED] 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: template = $3$493$4$ 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: template split into 3 pieces, starts with = true 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor processing result 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: Regex = (action=")(.*\.gx)(.*changeEdition\/)([^"]+) 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Match found! 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Template piece #0 = 3 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Template piece #1 = 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Template piece #2 = 4 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Template piece #3 = 493 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: RegexExtractor: Template piece #4 = 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.extractor.RegexExtractor: Regex Extractor result = /5133460/3542940/4719119/468/1101253233790/loot/C/changeEdition/loot493/ <===== 2004/11/23 17:40:51 [GUO Thread Group1-1] DEBUG - jmeter.protocol.http.sampler.HTTPSampler: Start : samplehttp://loot:8080/g-control/gocentura.gx/5133460/3542940/4719119/468/1101253233790/loot/C/changeEdition/loot493/ There are a couple of observations that I made while fiddling around with the logic here: 1. Under a HTTP request, consecutive regex elements are processed bottom-top. So, in the structure above, although the regex element for EditionID is below editionURL, EditionID is executed first. If I have EditionID regex before the editionURL regex, when i execute the test plan, jmeter does the editionURL regex first, since EditionID is not defined/declared yet, the literal "${EditionID}" is substituted in the template. 2. In the regex for editionURL, the template is $3$${EditionID}$4$. $3$ has been evaluated to "5133460/3542940/4719119/468/1101253233790/loot/C/changeEdition/" ${EditionID} = 493 $4$ has been evaluated to "loot" But ${editionURL} ends up being: /5133460/3542940/4719119/468/1101253233790/loot/C/changeEdition/loot493/ 3. I also find that if the variable name (eg. variable_name) contains an underscore, ${variable_name_g1} is not resolved to the variable value (in the PATH field of a HTTP request. Not sure about the rest of the places.) On Tue, 23 Nov 2004 19:56:15 +0000, sebb <[EMAIL PROTECTED]> wrote: > On Tue, 23 Nov 2004 14:28:59 -0500, Kyle McAbee <[EMAIL PROTECTED]> wrote: > [...] > > > Might a "How can I trouble-shoot a regular expression in JMeter?" topic be > > a useful addition to the FAQ? > > > > Yes, please! > > Anyone can update the FAQ. > > You just need to create an account first if necessary and login - see > the JMeter Wiki front page for details. [Registration was introduced > to reduce vandalism - and succeeded!] > > The information could be added to: > > http://wiki.apache.org/jakarta-jmeter/RegularExpressions > > either inline, or as a separate page linked to the above if that works better. > > S. > -- k.p. -- k.p. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]