Running JMeter tests from behind a proxy server

Sometimes you may need to create and run your tests from behind a proxy server / firewall. For instance when you're on the LAN / intranet and need to connect to the outside. This is very easy to do so, but it can be hard to find out for the first time.

Configuring the proxy server

You need to launch JMeter with one or more of the following options:
-H [proxy server or IP address]
-P [proxy server port]
-u [username for the proxy authentication]
-a [password for the proxy authentication]
Examples:

  • jmeter.bat -H 192.168.10.1 -P 8012
  • jmeter.bat -H 192.168.10.1 -P 8012 -u my_user_name -a my_password
The easiest way is to create a new .bat file which launches jmeter.bat with the options above and place it in the JMeter bin directory. This way you can easily switch between JMeter and JMeter with proxy, without having to enter the settings again. Download an example bat file with proxy here.

Note: This proxy mechanism is different from the built-in Http proxy server. The http proxy server can be used to record http browser sessions and requires you to modify set the browser proxy settings.

Testing the proxy server settings

There are several ways to check if the proxy server settings are correct. I prefer to connect to a public webservice as it is very easy to do so, e.g. the one from amazon: http://soap.amazon.com/schemas3/AmazonWebServices.wsdl. Create a WebService(SOAP) request, fill out the WSDL url and click the "Load WSDL" button. The "Web Methods" dropdown gets filled with the available webservice methods. Congratulations, you correctly set the proxy server settings as you managed to reach the public webservice. Download the JMeter webservice request test file here.

You don't get the the list of methods, instead you get an exception message? Check if  you get one of these messages:

Error1: The WSDL was not valid, please double check the url. org.apache.jmeter.protocol.http.util.WSDLException: Connection timed out: connect.

  • The proxy server settings are probably incorrect, double check the proxy server and proxy server port
Error2: The WSDL was not valid, please double check the url. org.apache.jmeter.protocol.http.util.WSDLException: Server redirected too many times(20)

  • The username and password are probably incorrect, double check the correctness of these data
Error3: The WSDL was not valid, please double check the url. org.apache.jmeter.protocol.http.util.WSDLException: http://soap.amazo.com/schemas3/AmazonWebServices.wsdl


  • The webservice is probably not up, or you made a typo like I did in the url above: amazo instead of amazon. Paste the url in a browser and check if you get an xml-like file describing the webservice.

Did you get get an other message? Leave a comment and I'll come back to you.

Related Posts by Categories

Comments

Recent Articles

Top Commenters

Recent Comments