Menu

how to set proxy for httpunit and htmlunit?

Help
2007-07-24
2013-04-25
  • Derek Kozikowski

    I've just started to use Jameleon, and after installing I tried to run the sample tests.  the httpunit-sourceforge.xml and htmlunit-sourceforge.xml fail with the error message "can not connect to 'http://sourceforge.net'."

    the jiffie-sourceforge.xml test passes.  selenium-sourceforge.xml test dies with an internal server error.

    My guess is that the httpunit and htmlunit test cases are failing because i need to use a proxy to get out of our network.  HTTPUNIT documentation recommends calling WebClient.setProxyServer( host, port ) before each submit.  I'm assuming that I should be able to simply set some configuration setting for Jameleon to handle this for me though.  Is there such a setting?  I couldn't find anything in documentation, and older forum entries said that older versions of Jameleon didn't support proxy user/passwords.  (I don't need a user/password, but I do need a port).  I have the 3.3M4 version from the .zip download installed.

    If there is no Jameleon setting, how would I go direct to fix httpunit?

    Thanks for your help and/or suggestions.
    Derek

     
    • Christian Hargraves

      Hi Derek,

      It is documented here:

      http://jameleon.sourceforge.net/httpunit-plugin/syntax-reference.html#hu-session

      The docs say they aren't context variables, but they actually are. This means an easy configuration would be to define in your application's properties file. For example, to get the sourceforge sample to work, create a file called "res/sf.properties". In the script, inside the hu-session tag, set application="sf". Then in sf.properties, set the variables like so:

      enableHttpUnitProxy=true
      httpUnitProxyHost=some.host.com
      httpUnitProxyPort=your proxy port #

      That should do the trick.

      I don't know what to say about the Selenium script. I haven't tried that plug-in with a proxy server (it is actually a proxy server itself).

       
    • Derek Kozikowski

      Thanks for the tip Christian.  Unfortunately it isn't working for me.  Hopefully the following information will help you to help me.

      the httpunit-sourceforge.xml file hu-session tag has:
      <httpunit-session application="sf" baseUrl="http://sourceforge.net" enableScripting="false" beginSession="true">

      the res/sf.properties file in full is (with the hostname obfuscated):
      enableHttpUnitProxy=true
      httpUnitProxyHost=proxy.foo.company.com
      httpUnitProxyPort=8080

      The console reports:
      Beginning Session: "net.sf.jameleon.plugin.htmlunit.HtmlUnitSessionTag"
      Begin: starting application
      Ending Session: "net.sf.jameleon.plugin.htmlunit.HtmlUnitSessionTag"

      htmlunit-sourceforge FAILED
      FunctionId: htmlunit-session
      Line #: 8
      Row #: 0
      Error Message: Can not connect to 'http://sourceforge.net'.

      And Velocity.log includes the following lines:
      2007-07-25 10:55:32,663 - ResourceManager : found TestCaseDocsTemplate.txt with loader net.sf.jameleon.util.VelocityClasspathResourceLoader
      2007-07-25 10:55:32,679 - Left side ($session.application.length()) of '>' operation has null value. Operation not possible. TestCaseDocsTemplate.txt [line 60, column 54]
      2007-07-25 10:55:32,679 - Left side ($session.organization.length()) of '>' operation has null value. Operation not possible. TestCaseDocsTemplate.txt [line 63, column 55]

       

Log in to post a comment.