In the proxy server it would be nice to have a ignore Web Server fields for the recorded results. There are two possible scenerios where this would be helpful. The first is when a variable is defined in the Test Plan element such as some sentinal value that is not meant to be part of a url. When the proxy server comes accross this in the URL it will substiute the name. i.e. I have the variable internet with the value of 2 and when I use my server lr2 the proxy server sets the Server name as lr${internet}. Which if the value for internet changes it breaks the test. The second scenerio, and this is the more helpful one, is I have a default Http request element already in a thread. In this case I do not want or need the Web Server infomation. And actually it is to my detriment if I want to change web servers. Example if I am benchmarking diffrent hardware profiles to see which runs my Web Server application. Then I would want the flexibilty to change the webserver in one place vs. having to change multiple http request samplers.
Works for me with a simple plan consisting of Thread Group - HTTP Defaults (http | www.apache.org | 80) WorkBench - Proxy server See: http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Proxy_Server and http://jakarta.apache.org/jmeter/usermanual/best-practices.html#proxy_server
Created attachment 15154 [details] A testplan that demonstrates the problem
Attached is a testplan that I recorded that demonstrates the problem that I explain in this request. Note all of the http requests are www.${not_http}gle.com because I have a variable that it replaced. Because this variable may not be intended for the http requests I do not think it should be included in them.
The attached test plan has a default host of google.com, but the URL sampled appears to have been www.google.com. Try fixing the test plan to use the hostname www.google.com as default. This will prevent the substitution of goo by ${not_http}. Seems to me this fixes your second scenario. As to the first scenario, perhaps you could be more specific about how you would like variable substitution to work. i.e. under what circumstances should the variable be replaced. To maintain backward compatibility, there would also need to be a way of telling JMeter to use the new replacement algorithm.
"Try fixing the test plan to use the hostname www.google.com as default." This would only work if I deleted not_http first and then added a hostname variable to the top of the list. And in the case that is not the simple test case I created to demonstrate this problem that would mean I would have to delete all the variables before the hostname. It is possible to do this but I would think the software should be a little more flexible. And as for "As to the first scenario, perhaps you could be more specific about how you would Like variable substitution to work. i.e. under what circumstances should the Variable be replaced. " I think that the problem is in the proxy server and not in all of JMeter. The substitution for variables should be maintained as normal when running the test case, but when recording only time string replacement should be done is on an entire string and not in a substring. Example: (in the sample test case) If I add the variable hostname www.google.com And start to record again. I will get the same result I did before because it is doing a replacement on part of the string which may not be what the user intended. Such as demonstrated in the first example test scenario where I had a server name variable but I had a weight variable before it. If the proxy server matched the entire string it would have found my server variable further down the list. Though if I did not have a servername variable I do not think I would want part of the servername being replaced when recording.
When I tried using www.google.com in the HTTP default test element, the hostname was omitted from the generated HTTP requests, and so there was no "goo" for the not_http variable to be matched against. As to substitution, the Proxy currently substitutes the contents of a variable - "goo" - with the variable name - ${not_http} - wherever the content string appears. You are asking for the substitution to be restricted to complete strings only. Fair enough, and this should be easy to change, but it might break existing scripts. So I suggest adding whole string matching as an option in the Proxy GUI - or perhaps as a property. Would that meet your needs?
Yes either solution would be fine. Though I would perfer it to be in the Proxy GUI.
Decided to make it a bit more flexible, and added RE matching. Proxy GUI has been updated to add a new checkbox - "Regex matching". This treats the values as regexes, so full string matching can be specified by enclosing the value in ^ and $, e.g. ^2$ for the internet example. [Also fixed Proxy so TestElement.gui_class etc are not replaced] Nightly build 20050528 contains the fixes
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1545