On 17/11/2008, Willoughby, Kevin <[EMAIL PROTECTED]> wrote:
> I'm having trouble parameterizing a URL in Jmeter (v 2.3.2).
>
>  I have a logfile of URLs, read with a CSV Data Set, and a second file of 
> parameter values read with a second CSV Data Set. I want to replace a 
> parameter ("mac_address") in the URL with the value from the second file. 
> I.e., I want to convert 
> http://localhost/info?macAddress=00%3A19%3Aa6%3A10%3A89%3Ade&; to 
> /info?macAddress=${mac_address}&

That does not agree with your example below, where the macAddress appears later.

>  I'm using an HTTP Request path of
>  
> ${__regexFunction(.*//[^/]*(.*)acAddress=[0-9a-fA-F%]*(.*),$1$acAddress=${mac_address}$2$,1,,${url},mac_url,url)}

This is composed of:

Regex:   .*//[^/]*(.*)acAddress=[0-9a-fA-F%]*(.*)
Template: $1$acAddress=${mac_address}$2$
Match number: 1
ALL separator:
Default:       ${url}
Reference Name: mac_url
Input variable: url

>  to both remove the "http://localhost"; from the url and to replace the 
> mac-address parameter. Alas, I'm getting the mac_address at the end of the 
> url, not in the middle.
>
>  A Debug Sampler shows:
>  
> url=http://localhost/SM_WS/rest/customer/info?accountNumber=12340019A61089DE&macAddress=00%3A19%3Aa6%3A10%3A89%3Ad
>  e&name=spam

OK.

>  
> mac_url=/SM_WS/rest/customer/info?accountNumber=12340019A61089DE&m&name=spamacAddress=00%3A00%3A39%3Abc%3A16%3A5e

This is a bit odd.

>  
> mac_url_g0=http://localhost/SM_WS/rest/customer/info?accountNumber=12340019A61089DE&macAddress=00%3A19%3Aa6%3A10%3A89%3Ade&name=spam

OK, the whole URL is matched by the pattern.

>  mac_url_g1=/SM_WS/rest/customer/info?accountNumber=12340019A61089DE&m

OK, this is the bit before the macAddress.

>  mac_url_g2=&name=spam

OK, this is the bit after the macAddress

>  mac_url_matchNr=1
>
>  Am I doing something wrong, or is this a bug in JMeter?

It's a bug in JMeter.

Not sure why yet, but if the template looks like:

$1$xxx$2$

then it is handled as

$1$$2$xxx

whereas

aaa$1$xxx$2$

works OK.

So a work-round is to add some leading text to the template - even a
space will do.

e.g. in your case you could use "/", just change the RE to:

Regex:   .*//[^/]*/(.*)acAddress=[0-9a-fA-F%]*(.*)

By the way, the leading .* could be dropped.


>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to