[Webtest] problem with redirect after button invocation

Marc Guillemot webtest@lists.canoo.com
Mon, 19 Jul 2004 11:22:38 +0200


Not sure that
   http://myserver/login?jumpTo=http://myserver/start
is a correct url. Shouldn't the paramater value be encoded as
   http://myserver/login?jumpTo=http%3A%2F%2Fmyserver%2Fstart

Marc.

Luca Scheuring wrote:
> 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. 
> 
> the function 
> 	private String stripDoubleSlashes( String url )
> normalizes URLs by collapsing // into /. 
> 
> the url that webtest got by 302-redirect looked like:
> Location: http://myserver/login?jumpTo=http://myserver/start
> 
> this url was transformed to
> http://myserver/login?jumpTo=http:/myserver/start
> which of course caused the 404...
> 
> after patching the WebRequest-class it works fine.
> 
> 
>>-----Ursprüngliche Nachricht-----
>>Von: webtest-admin@lists.canoo.com 
>>[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
>>
>>Try setting the log level to debug in the 
>>WEBTEST_HOME/lib/log4j.properties, you will see a bit more 
>>what is working.
>>
>>Page not found means return code 404 and not 302. May it be 
>>that the page to which the server want to redirect with a
>>302 doesn't exist?
>>
>>Marc.
>>
>>Luca Scheuring wrote:
>>
>>>hello webtest community
>>>
>>>here my test scenario:
>>>- invocation of a http location
>>>- server sends redirect (302) to a https location which contains a 
>>>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 
>>>location (I know this from the webserver log-file)
>>>- webtest switches the protocol back to http and accesses 
>>
>>the new http 
>>
>>>location (this step fails)
>>>
>>>problem:
>>>it seems that webtest can't handle the redirect which is received 
>>>after the button invocation. since this works fine using 
>>
>>only http (no 
>>
>>>https), I guess the problem is the redirect to a http-site 
>>
>>as a result 
>>
>>>of a button invocation when using https before.
>>>
>>>this is the message I get:
>>>Test step clickbutton named "Click the submit button" failed with 
>>>message "Step "clickbutton "Click the submit button" (6/7): 
>>
>>Page not 
>>
>>>found : click button"
>>>
>>>in general, switching between http and https released by redirects 
>>>seems to work fine in both directions.
>>>
>>>I know that my scenario might be a bit unusual but it's the way the 
>>>website that I want to test works.
>>>
>>>did anybody encounter this problem or does have an idea what I am 
>>>doing wrong? (see my ant script below)
>>>
>>>thanx,
>>>
>>>--luca
>>>
>>>-------------------------------------------
>>>
>>><target name="login">
>>>        <testSpec name="login" >
>>>	<config
>>>                host="myhost"
>>>                port="80"
>>>                protocol="http"
>>>                basepath="/"
>>>		saveresponse="true"
>>>		verbose="true"
>>>		summary="true"
>>>		resultfile="debug.xml"
>>>		showhtmlparseroutput="true"
>>>		 >
>>>	</config>
>>>        	<steps>
>>>		 <invoke
>>> 		  stepid="goto login page"
>>>  			 url="login.html" />
>>> 		<verifytitle stepid="check login"
>>>    			text="Login"  />
>>> 		<setinputfield stepid="set user name" 
>>> 		   name="credential_0"
>>> 		   value="username" />
>>>		 <setinputfield stepid="set password" 
>>>			name="credential_1"
>>> 			 value="*******" />
>>> 		<clickbutton   
>>> 			 label="Go"
>>> 			 stepid="Click the submit button" />
>>>             </steps>
>>>        </testSpec>
>>></target>