Hi,

try to write:

<groovy>step.context.webClient.useInsecureSSL=true</groovy>

before your first <invoke>

or

start webtest using shell:

start webtest.bat -f build.xml -Djavax.net.ssl.trustStore=C:\trust.keystore

hth,

Roman.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of EXT-Brooks, Marcum V
Sent: Donnerstag, 22. Mai 2008 19:08
To: [EMAIL PROTECTED]
Subject: [Webtest] Getting webtest to work with https


Hi there, 

I'm getting an exception when trying to test a web app using https.  I'm
still a relative newbie to webtest and any help anyone can provide would
be greatly appreciated.

Following an example I found in the Canoo WebTest Interest List
(http://lists.canoo.com/pipermail/webtest/2006q4/007296.html) I used IE
to export the certificates in DER enocded binary X.509 format and
imported them into a keystore (C:\trust.keystore): 

keytool -import -v -trustcacerts -file <the exported certificate file>
  -keystore trust.keystore -alias webtest1

I used the https.xml test (included in the webtest distribution) to base
my test on and that test (C:\MyPscrWebTestPoc\tests\SimplePscrTest.xml)
looks like this:

<?xml version="1.0"?>

<!DOCTYPE project SYSTEM "../dtd/Project.dtd">

<project name="SimplePscrTest" default="all" basedir=".">
    
    <target name="all" depends="callBaseHttps"/>
    
    <target name="callBaseHttps">
        <antcall target="SimplePscrTest">
            <param name="webtest.port" value="443"/>
            <param name="webtest.protocol" value="https"/>
            <param name="webtest.truststore.file"
value="../../trust.keystore"/>
            <param name="webtest.truststore.passphrase"
value="<<password>>"/>
            <param name="webtest.connectioninitializer"
value="com.canoo.webtest.security.SunJsseBaseConnectionInitializer"/>
        </antcall>
    </target>

    <target name="callClientAuthHttps">
        <antcall target="SimplePscrTest">
            <param name="webtest.port" value="443"/>
            <param name="webtest.protocol" value="https"/>
            <param name="webtest.truststore.file"
value="../../trust.keystore"/>
            <param name="webtest.truststore.passphrase"
value="<<password>>"/>
            <param name="webtest.connectioninitializer"
value="com.canoo.webtest.security.SunJsseClientAuthConnectionInitializer
"/>
            <param name="webtest.keystore.file"
value="../../trust.keystore"/>
            <param name="webtest.keystore.passphrase"
value="<<password>>"/>
            <param name="webtest.keystore.alias" value="webtest1"/>
        </antcall>
    </target>

        <target name="SimplePscrTest">
                <webtest name="My simple PSCR Test: Call Https with
${webtest.connectioninitializer}">
                <config
              host="<<host name>>"
              port="443"
              protocol="https"
              basepath="tps2"
              summary="true"
              resultfile="results.xml"/>
                <steps>
                        <invoke url="jsp/tps2home.jsp" description="Home
Page" />
                        <verifyTitle text="Landing Page" 
                                description="We should see the page
title" />
                </steps>
                </webtest>
        </target>
        
</project>

The exception I am getting is this:  

--- Nested Exception ---
C:\MyPscrWebTestPoc\tests\SimplePscrTest.xml:33: Canoo Webtest: R_1551.
Test failed.
Exception raised: javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested
targetjavax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilder
Exception: unable to find valid certification path to requested target
        at
com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1518
)
        at
com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174)
        at
com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168)
        at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHa
ndshaker.java:848)
        at
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHands
haker.java:106)
        at
com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)
        at
com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:4
33)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java
:818)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSo
cketImpl.java:1030)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.jav
a:622)
        at
com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:
59)
        at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
        at
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
        at
org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(Ht
tpConnection.java:827)
        at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpCon
nectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManag
er.java:1525)
        at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase
.java:1975)
        at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
:993)
        at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe
thodDirector.java:397)
        at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho
dDirector.java:170)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
96)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
46)
        at
com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConne
ction.java:126)
        at
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection
(WebClient.java:1424)
        at
com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1
381)
        at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:332)
        at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:399)
        at
com.canoo.webtest.steps.request.TargetHelper.getResponse(TargetHelper.ja
va:69)

Again, any help anyone can provide would be greatly appreciated.

Thanks, 
Marc Brooks


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to