Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to default HTTP request to servername followed by path in JMeter

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/,[email protected],10,true,WIN

What's preventing JMeter from adding /test to the default URL?

like image 323
Sara Fuerst Avatar asked May 13 '16 14:05

Sara Fuerst


3 Answers

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

like image 196
Adnan Avatar answered Oct 02 '22 22:10

Adnan


Use userdefined variables

Declare the "/test" as PATHVARIABLE in a user defined variable.

In each request append the variable to the path ${PATHVARIABLE}/yourUrl

like image 27
vishnumanohar Avatar answered Oct 02 '22 22:10

vishnumanohar


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!

like image 23
Sara Fuerst Avatar answered Oct 02 '22 21:10

Sara Fuerst