I'm new to JMeter and am having trouble figuring out how to get my default URL to be what I want it to be. Right now, I've added an HTTP Request Defaultsconfig element to my test plan. In the Web Server box I have a url of the following format:
testproject.company.com
What I actually want the default URL to be is
testproject.company.com/test
The first thing I tried was setting the Server Name or IP to testproject.company.com/test, but this gave me an error
java.net.UnknownHostException: testproject.company.com/test
Next, I set Server Name or IP back to testproject.company.com and filled in the Path box in the HTTP Request section with
/test
This does not cause any errors, but all of my tests fail because it is simply using testproject.company.com as the default URL.
I am also using a Project Files config, and within the Configure the CSV Data Source section, in the Filename box, have the path to a .csv file. The .csv file has the following contents:
testproject.company.com/test/,username#testproject.train,10,true,WIN
What's preventing JMeter from adding /test to the default URL?
I believe the issue is due to a misunderstanding of the Path field under the HTTP Request Defaults section. It appears that the path in that section will only be used for tests where a path is not defined. So instead of adding the path from the test to the default path, it simply replaces it. Because of this, you have to manually add the path to each test that specifies a path.
If anyone knows of a better way to do this, let me know!
Use userdefined variables
Declare the "/test" as PATHVARIABLE in a user defined variable.
In each request append the variable to the path
${PATHVARIABLE}/yourUrl
Add "HTTP Sampler" under Thread group. In HTTP Request Defaults define Server IP as testproject.company.com and in HTTP Sampler define "/test" as Path.Leave the Server Name or IP field blank.
Thanks
The first thing I tried was setting the Server Name or IP to
testproject.company.com/test, but this gave me an error
java.net.UnknownHostException: testproject.company.com/test
It appears that this error is given depending on which "implementation" you are using for the HTTP Request sampler.
Setting the implementation to anything other than 'Java' (e.g. HttpClient4) solved this problem for me.
Related
I'm running Apache 2.4 and I'd like to see the values being received for some HTTP variables, like HTTP_ACCEPT. Thanks for any help.
You can use CustomLog, which allows logging of anything that can expressed in a custom log format, including %{VARNAME}i to log HTTP headers:
%{VARNAME}i
The contents of VARNAME: header line(s) in the request sent to the server. Changes made by other modules (e.g. mod_headers) affect this. If you're interested in what the request header was prior to when most modules would have modified it, use mod_setenvif to copy the header into an internal environment variable and log that value with the %{VARNAME}e described above.
I am running an Apache Flume http source on localhost and binding it to a port, as described in the documentation:
agent.sources.httpSource.type = http
...
agent.sources.httpSource.port = 80
Now my source is listening on http://<ip>:80. How can I modify it so it could run with a path in the url? like so: http://<ip>:80/example_path?
I didn't find anything in the documentation and in the web concerning this issue.
have you tried to simply sent the data to http://<ip>:80/example_path? As far as a I know, it should work, independently of the path within the URL. A very different thing is if you want to implement a specific behaviour depending on the path. In that case, you will have to create a custom handler for the HTTPSource source by extending HTTPSourceHandler.
I need to setup intern to test ajax calls from a different server. I set everything up sort of following the official wiki in this address
https://github.com/theintern/intern/wiki/Using-Intern-to-unit-test-Ajax-calls
My config file has proxyUrl set to http://localhost:8080/sub
and http://localhost:8080/sub is setup as a reverse proxy to inter-runner in http://localhost:9000
When I run ./node_modules/.bin/intern-runner -config=tests/config from the tests root folder, the browser opens up and is able to request several files, until it tries to request the config file. That's when it receives a 404, because it requests the wrong address - http://localhost:8080/tests/config.js - without the sub folder.
I'm wondering if I'm missing something inside the config file, or if intern is not able to use proxies with subfolders. I tried to set the baseUrl parameter, but it had no effect.
Any ideas?
Update:
It seems that sometimes intern-runner uses the path provided in the config param, and sometimes it uses the one in the proxyUrl parameter inside the config file. As a workaround, what I did was to place the config file and the tests on 2 folders (actually I made a symbolic link). The first on tests/ and the second on sub/tests/ and ran it using ./node_modules/.bin/intern-runner -config=sub/tests/config.
It works, but it's kind of stupid and I really wished there was a better way to do it.
This is indeed a limitation/bug of intern. It assumes that the proxy sits at the root of the absolute domain name, i.e. that it has a pathname of /.
An issue has been created on intern's github repository here and the corresponding pull request that fixes the problem is here. Hopefully this gets merged into the upcoming 2.1 release of intern.
What is the use of Base URL is Selenium IDE because even when I enter the wrong URL there or leave it blank, and run the script, it just runs fine.
I have this URL, as base URL http://test.info:50/test and in the open command when I use the part /test of the URL, so the URL to be opened should be http://test.info:50/test/test (which is not the actual URL) and selenium keeps running the script on the Base URL above and shows no error.
So, my question hear is what is the use of Base URL when it could be left blank or empty. What is the use of the Open command when I have used the full URL in the Base URL part.
Hope the question is clear. Please help.
The base URL should be the index of your site. NOT the directory under test.
For example,
BaseURL: http://google.com/
Open: /search
This will open http://google.com/search as the beginning Url. From then, you should continue testing.
In your case, specify
BaseURL: http://test.info:50/
Open: /test
And you'll be golden.
EDIT:
and selenium keeps running the script on the Base URL above and shows no error.
Selenium IDE will show no errors because Selenium IDE doesn't care where your test is ran.. it's not limited to that (nor should it be). It will only spit out an error for something is wrong in your script. Nothing to do with your opening of urls. You could open something like /somebullcrapdirectory and it'd still be fine. It'd fail at the point of performing any subsequent actions though, since /somebullcrapdirectory would actually be an invalid directory.
I hope you understand Abhi,
When user give the blank base url after that comes the error,
[warn] Base URL is not set. Updating base URL from current window.
[error] baseUrl wasn't absolute:
We can simply use the open command and leave the target section blank.
This will use the base URL and open it.
The URL specified in Base URL input field in de Selenium IDE, and the URL specified in the target parameter of the open command, will not just simply be concatenated. Opening /test/ will just be seen as an absolute URL for your domain.
You can, however, specify a target ./test/, which requests, as I experienced, requests http://test.info:50/test/test/. I find this very useful, as in some environments, my web application will reside on the root and in some other environments in a base path like /myapp/.
With respect to a blank Base URL, I assume that this worked because the browser page in which the test was run already showed a page from the correct domain. If you would have executed the open command on a page in any other site, the open command would have requested the page /test/ from that site. After that, that base URL would have pointed to that site.
I am using Apache JMeter 2.7 to load test Liferay. One such test I am creating involves dynamically generating files and uploading them to Liferay's Document and Media portlet. The problem I'm having has nothing to do with Liferay though... I know this because I can upload a document if I type the exact path into the "file path" box of "Send Files With the Request" in an HTTP request. This is not how I need the test to run.
I want the test to run in such a way that I generate a unique file each loop of the test with a different UUID for the file name (I do so in a BeanShell PreProcessor and it does as I want). I have a user defined variable FILENAME that I use to store the file name. In the HTTP Request, for the file path I use the path C:\Installs\Apache Jmeter\apache-jmeter-2.7\bin\${FILENAME} but JMeter does not process the variable.
When I view the Results Tree, I see the error:
java.io.FileNotFoundException: C:\Installs\Apache
Jmeter\apache-jmeter-2.7\bin\${FILENAME} (The system cannot find the
file specified)
Yet, if I hard code the file path (for example ...\bin\doc.txt) and use ${FILENAME} as the value for the title of the document(a parameter I send in the HTTP Request), the document(doc.txt) uploads to the portlet with the string value of FILENAME as the title. This lets me know the right string is stored in the variable FILENAME. From this, I deduce that JMeter simply does not replace variables in the file path for sending files in an HTTP Request. If I am incorrect in this conclusion, please let me know how to fix whatever error I have. Has anyone else had this problem?
I am currently trying to create a workaround by adding a BeanShell PreProcessor to this http request that would dynamically update the filepath with the variable name. I would need to set some variable = vars.get("FILENAME"). Anyone know how to proceed from here to set the HTTP file path programmatically? I'm looking in the API for the answer. Any help would be much appreciated because I am completely stumped right now.
It is failing because you use \${FILENAME}.
This escapes $ so variable is not interpreted.
Solution:
C:\\Installs\\Apache Jmeter\\apache-jmeter-2.7\\bin\\${FILENAME}
(I cannot test as I am on Mac OS);
C:/Installs/Apache Jmeter/apache-jmeter-2.7/bin/${FILENAME}
(this works on Windows sure).