Hi,

I have a test like this (the point is the proxy settings):
public class GoogleBrowseTest extends WebTestCase {
    public void setUp() {
        setTestingEngineKey( TestingEngineRegistry.TESTING_ENGINE_HTMLUNIT );
        getTestContext().setBaseUrl( "http://www.google.com"; );

        TestContext ctx = this.getTestContext();
        ctx.setProxyPort( 88 );
        ctx.setProxyName( "proxy" );
    }
    public void testSearch() throws Exception {
        beginAt( "/" );
        setTextField( "q", "htmlunit" );
        submit( "btnG" );
    }
}
but the proxy settings in net.sourceforge.jwebunit.TestContext is never applied 
and I dont get a connection to google.

In  net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.beginAt(String initialURL, 
TestContext context) you call initWebClient() and here you create a 
com.gargoylesoftware.htmlunit.WebClient (from the htmlUnit project) with
wc = new WebClient(new BrowserVersion(BrowserVersion.INTERNET_EXPLORER,
      "4.0", testContext.getUserAgent(), "1.2", 6));

but to apply the proxy settings from TestContext you should call the other 
WebClient constructor like this:
wc = new WebClient(new BrowserVersion(BrowserVersion.INTERNET_EXPLORER,
      "4.0", testContext.getUserAgent(), "1.2", 6), testContext.getProxyName, 
testContext.getProxyPort);

Please let me know if I am wrong or have misunderstood. By the way I am not 
comfortable with the alternative approach when building with maven of setting 
the proxy settings inside the System class like described here:
http://www.it-eye.nl/weblog/2005/07/07/jwebunit-untrusted-certificates-https-and-proxies/

This is the version of jwebunit im using:
        <dependency>
          <groupId>net.sourceforge.jwebunit</groupId>
          <artifactId>jwebunit-htmlunit-plugin</artifactId>
          <version>1.3</version>
          <scope>test</scope>
        </dependency>

-Endre
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JWebUnit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to