[Webtest] testing https site

Lisa Crispin webtest@lists.canoo.com
Fri, 09 Jul 2004 22:05:20 +0000


Hi Mittie,
I did try exporting a certificate from the browser. I tried to set that connectionInitializer property as shown in sslTest.xml, but I got a null pointer; maybe I don't have it in the right place or something.

The sslTest.xml example is very confusing to read, since I am a relative WebTest newbie.  Does anyone have a simple example?  

When I set this property:
<property name="webtest.connectioninitializer" value="com.canoo.webtest.security.SunJsseBaseConnectionInitializer" />

I get this error:
main:
 [testSpec] com.canoo.webtest.security.ConnectionInitializationException: java.l
ang.NullPointerException
 [testSpec]     at com.canoo.webtest.security.SunJsseBaseConnectionInitializer.g
etTrustManagers(SunJsseBaseConnectionInitializer.java:119)
 [testSpec]     at com.canoo.webtest.security.SunJsseBaseConnectionInitializer.i
nstallTrustAndKeyManager(SunJsseBaseConnectionInitializer.java:84)
 [testSpec]     at com.canoo.webtest.security.SunJsseBaseConnectionInitializer.i
nitializeConnection(SunJsseBaseConnectionInitializer.java:42)
 [testSpec]     at com.canoo.webtest.steps.request.Target.invokeCustomInitialize
r(Target.java:241)
 [testSpec]     at com.canoo.webtest.steps.request.Target.prepareConversation(Ta
rget.java:202)
 [testSpec]     at com.canoo.webtest.steps.request.Target.getResponse(Target.jav
a:178)
 [testSpec]     at com.canoo.webtest.steps.request.Target$2.call(Target.java:156
)
 [testSpec]     at com.canoo.webtest.steps.request.Target.protectedGoto(Target.j
ava:106)
 [testSpec]     at com.canoo.webtest.steps.request.Target.gotoTarget(Target.java
:153)
 [testSpec]     at com.canoo.webtest.steps.request.InvokePage.doExecute(InvokePa
ge.java:37)
 [testSpec]     at com.canoo.webtest.steps.Step.execute(Step.java:99)
 [testSpec]     at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:26)
 [testSpec]     at com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpeci
ficationTask.java:68)
 [testSpec]     at org.apache.tools.ant.Task.perform(Task.java:341)
 [testSpec]     at org.apache.tools.ant.Target.execute(Target.java:309)
 [testSpec]     at org.apache.tools.ant.Target.performTasks(Target.java:336)
 [testSpec]     at org.apache.tools.ant.Project.executeTarget(Project.java:1339)

 [testSpec]     at org.apache.tools.ant.Project.executeTargets(Project.java:1255
)
 [testSpec]     at org.apache.tools.ant.Main.runBuild(Main.java:609)
 [testSpec]     at org.apache.tools.ant.Main.start(Main.java:196)
 [testSpec]     at org.apache.tools.ant.Main.main(Main.java:235)

BUILD FAILED
file:c:/canoo/SmokeTest/gold.xml:14: Test failed.
Exception raised: com.canoo.webtest.engine.StepExecutionException: ConnectionIni
tializer raised exception: com.canoo.webtest.security.ConnectionInitializationEx
ception: java.lang.NullPointerException, Step: InvokePage at file:c:/canoo/Smoke
Test/gold.xml:31:  with (stepId="Go to main page", url="control.jsp?fid=2", step
Type="invoke")com.canoo.webtest.engine.StepExecutionException: ConnectionInitial
izer raised exception: com.canoo.webtest.security.ConnectionInitializationExcept
ion: java.lang.NullPointerException, Step: InvokePage at file:c:/canoo/SmokeTest
/gold.xml:31:  with (stepId="Go to main page", url="control.jsp?fid=2", stepType
="invoke")
        at com.canoo.webtest.steps.request.Target.invokeCustomInitializer(Target
.java:243)
        at com.canoo.webtest.steps.request.Target.prepareConversation(Target.jav
a:202)
        at com.canoo.webtest.steps.request.Target.getResponse(Target.java:178)
        at com.canoo.webtest.steps.request.Target$2.call(Target.java:156)
        at com.canoo.webtest.steps.request.Target.protectedGoto(Target.java:106)

        at com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:153)
        at com.canoo.webtest.steps.request.InvokePage.doExecute(InvokePage.java:
37)
        at com.canoo.webtest.steps.Step.execute(Step.java:99)
        at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:26)
        at com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecification
Task.java:68)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

Thanks,
Lisa


-------------- Original message from "Dierk Koenig" : -------------- 
> Hi Lisa, 
> 
> have a look into the https usage description in webtests doc folder. 
> It may not be in the doc.zip but at least it can be obtained from the cvs. 
> 
> You need to set https as protocol. 
> You need to set some other properties like the "connectionInitializer" 
> class. 
> It seems you are going for plain https without client-side certificates, so 
> SunJsseBaseConnectionInitializer would be the one to go for. 
> In any case you need a proper server certificate such that webtest can 
> verify the connection. Most often this certificate can be exported from 
> your browser (after having connected to the server through that browser 
> and having accepted the server certificate). 
> 
> https is always tricky... 
> cheers 
> Mittie 
> 
> -----Original Message----- 
> From: webtest-admin@lists.canoo.com 
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of Lisa Crispin 
> Sent: Freitag, 9. Juli 2004 23:09 
> To: webtest@lists.canoo.com 
> Subject: [Webtest] testing https site 
> 
> 
> Hello, 
> I'm trying to run my tests against one of our sites which is https, on port 
> 443. I changed the port number in my config, and left the protocol as http 
> since the doc says only http and file are supported. I have jdk 1.4.2 so 
> JSSE should not be an issue. I get the error below. Nothing at all is 
> written to the result directory. It takes a really long time for the error 
> to come back. 
> 
> One thing is this server doesn't have a valid certificate. If I invoke it 
> in a browser, I get a popup window about the certificate. Could this be 
> what is causing my test to fail? If not, what else might it be? 
> 
> Thanks, 
> Lisa 
> 
> main: 
> [testSpec] ERROR (Step.java:333) - Cannot handle unexpected exception in 
> step I 
> nvokePage at file:c:/canoo/SmokeTest/gold.xml:29: with (stepId="Go to main 
> page 
> ", url="control.jsp?fid=2", stepType="invoke") 
> [testSpec] java.io.IOException 
> [testSpec] at 
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Ht 
> tpURLConnection.java:591) 
> [testSpec] at 
> java.net.HttpURLConnection.getResponseCode(HttpURLConnection. 
> java:272) 
> [testSpec] at 
> com.meterware.httpunit.HttpWebResponse.readResponseHeader(Htt 
> pWebResponse.java:159) 
> [testSpec] at 
> com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebRes 
> ponse.java:197) 
> etc. etc (do you need the rest?) 
> 
> 
> 
> _______________________________________________ 
> WebTest mailing list 
> WebTest@lists.canoo.com 
> http://lists.canoo.com/mailman/listinfo/webtest 
> 
> _______________________________________________ 
> WebTest mailing list 
> WebTest@lists.canoo.com 
> http://lists.canoo.com/mailman/listinfo/webtest