[Webtest] problem with redirect after button invocation

Luca Scheuring webtest@lists.canoo.com
Fri, 16 Jul 2004 15:50:51 +0200


hi marc

thanx a lot for the tip with the debug level. I was looking for this =
feature
but haven't found it...

the debug output helped me to find the problem. it's a bit tricky and =
has
nothing to do with webtest itself. for geeks: see explanation below

--luca


the problem lied in the com.meterware.httpunit.WebRequest-class of the
httpunit distribution.=20

the function=20
	private String stripDoubleSlashes( String url )
normalizes URLs by collapsing // into /.=20

the url that webtest got by 302-redirect looked like:
Location: http://myserver/login?jumpTo=3Dhttp://myserver/start

this url was transformed to
http://myserver/login?jumpTo=3Dhttp:/myserver/start
which of course caused the 404...

after patching the WebRequest-class it works fine.

> -----Urspr=FCngliche Nachricht-----
> Von: webtest-admin@lists.canoo.com=20
> [mailto:webtest-admin@lists.canoo.com] Im Auftrag von Marc Guillemot
> Gesendet: Freitag, 16. Juli 2004 12:01
> An: webtest@lists.canoo.com
> Betreff: Re: [Webtest] problem with redirect after button invocation
>=20
> Try setting the log level to debug in the=20
> WEBTEST_HOME/lib/log4j.properties, you will see a bit more=20
> what is working.
>=20
> Page not found means return code 404 and not 302. May it be=20
> that the page to which the server want to redirect with a
> 302 doesn't exist?
>=20
> Marc.
>=20
> Luca Scheuring wrote:
> > hello webtest community
> >=20
> > here my test scenario:
> > - invocation of a http location
> > - server sends redirect (302) to a https location which contains a=20
> > login-form
> > - webtest follows redirect and switches properly to https protocol
> > - webtest fills out the form values and invokes the login button
> > - server sends back (still using https) a redirect (302) to a http=20
> > location (I know this from the webserver log-file)
> > - webtest switches the protocol back to http and accesses=20
> the new http=20
> > location (this step fails)
> >=20
> > problem:
> > it seems that webtest can't handle the redirect which is received=20
> > after the button invocation. since this works fine using=20
> only http (no=20
> > https), I guess the problem is the redirect to a http-site=20
> as a result=20
> > of a button invocation when using https before.
> >=20
> > this is the message I get:
> > Test step clickbutton named "Click the submit button" failed with=20
> > message "Step "clickbutton "Click the submit button" (6/7):=20
> Page not=20
> > found : click button"
> >=20
> > in general, switching between http and https released by redirects=20
> > seems to work fine in both directions.
> >=20
> > I know that my scenario might be a bit unusual but it's the way the=20
> > website that I want to test works.
> >=20
> > did anybody encounter this problem or does have an idea what I am=20
> > doing wrong? (see my ant script below)
> >=20
> > thanx,
> >=20
> > --luca
> >=20
> > -------------------------------------------
> >=20
> > <target name=3D"login">
> >         <testSpec name=3D"login" >
> > 	<config
> >                 host=3D"myhost"
> >                 port=3D"80"
> >                 protocol=3D"http"
> >                 basepath=3D"/"
> > 		saveresponse=3D"true"
> > 		verbose=3D"true"
> > 		summary=3D"true"
> > 		resultfile=3D"debug.xml"
> > 		showhtmlparseroutput=3D"true"
> > 		 >
> > 	</config>
> >         	<steps>
> > 		 <invoke
> >  		  stepid=3D"goto login page"
> >   			 url=3D"login.html" />
> >  		<verifytitle stepid=3D"check login"
> >     			text=3D"Login"  />
> >  		<setinputfield stepid=3D"set user name"=20
> >  		   name=3D"credential_0"
> >  		   value=3D"username" />
> > 		 <setinputfield stepid=3D"set password"=20
> > 			name=3D"credential_1"
> >  			 value=3D"*******" />
> >  		<clickbutton  =20
> >  			 label=3D"Go"
> >  			 stepid=3D"Click the submit button" />
> >              </steps>
> >         </testSpec>
> > </target>
> >=20
> > _______________________________________________
> > WebTest mailing list
> > WebTest@lists.canoo.com
> > http://lists.canoo.com/mailman/listinfo/webtest
> >=20
>=20
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>=20