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 Defaults
config 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/,[email protected],10,true,WIN
What's preventing JMeter from adding /test
to the default URL?
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
Use userdefined variables
Declare the "/test" as PATHVARIABLE in a user defined variable.
In each request append the variable to the path ${PATHVARIABLE}/yourUrl
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With