[Webtest] HTTP error 302

Rob Manthey Rob Manthey <canoo@rob.manthey.id.au>
Fri, 17 Nov 2006 09:15:08 +1000


This is a multi-part message in MIME format.
--------------000402010908030803040502
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit

I'm not a great expert, just an average user, but *I* can't see anything 
in the url that I would expect to baulk webtest.
(I think) the key here is that your url is immediately redirected by the 
server to another page yes?  hence the 302, which is handled without 
notification to the user by the average browser.  But webtest parks at 
the 302 (correctly because it is the honest truth!) and doesn't process 
the redirect and further?  So what you want to do is nudge it on the 
next step down the track, which a normal browser would do silently, and 
process the 302 redirect's target page.   No *I* don't know how to do 
this offhand, but hopefully we've clarified your problem and 
requirement  (if not please correct this description!) and I imagine one 
of the gurus will come online sometime in the next few hours and either 
toss a solution at you or declare it a shortfall.
No under no circumstances is webtest intended to be useable only by java 
coders, though it is perhaps starting to rely on people being able to 
slip in snippets of groovy lately where in the (distant) past it was all 
declarative xml.
How are those icebergs going over there?  Keep them over there won't 
you, we don't want them sailing up the Brisbane river!
Rob


on 17/11/06 08:50 Charlie Kuharski said the following:
> Reaching via a browser is fine.  I can see it also.  Know that WebTest 
> is build upon the HtmlUnit's API. 
> As far as being reachable via HtmlUnit, this is only a guess, but I'm 
> guessing the URL is passed through to be used by HtmlUnit.  So I'm 
> guess it's the culprit.  There is a slight chance it's WebTest 
> mangling the name somehow, but I doubt it.  Wouldn't know for sure 
> until someone looks at the source.
> Try using the IP address instead.
>
> John and Pip wrote:
>> Hi Charlie,
>>
>> Thanks for your response.
>>
>> Do you mean you couldn't reach 
>> https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do 
>> from a browser or that you think WebTest believes it is not 
>> reachable? This is the main public URL of the Air New Zealand flight 
>> booking engine, and we have a screen up in the office showing 
>> bookings coming through every minute!
>>
>> re testing with HTMLUnit: I'm not a java programmer - just a tester, 
>> trying to figure out whether I need to be a java programmer to use 
>> WebTest!
>>
>> Thanks for the hint re version number. I see this is R_1389. In fact 
>> to my embarrassment I see this even appears in my email below!
>>
>> regards,
>>          John
>>
>> On 11/17/06, *Charlie Kuharski* <ckuharsk@nmdp.org 
>> <mailto:ckuharsk@nmdp.org>> wrote:
>>
>>     Your host is not reachable.  I'm guessing it HtmlUnit.  Try using
>>     something without the "...co.nz". You could try and test with
>>     HtmlUnit.
>>     An ugly was to discover the version is to
>>
>>     1) replace your steps with this only:
>>             <verifyTitle
>>               description="we should see the login title"
>>               text="Login Page" />
>>
>>     2) you should see something like:
>>     C:\test\Translink\gtest1.xml:12: Canoo Webtest: R_1393.
>>     Test failed.
>>     Exception raised:
>>     com.canoo.webtest.engine.StepExecutionException: No current
>>     response available! Is previous invoke miss
>>     itle at C:\test\Translink\gtest1.xml:30:  with (description="we
>>     should see the login title", taskName="verifyTitle", text
>>     anoo.webtest.engine.StepExecutionException: No current response
>>     available! Is previous invoke missing?, Step: VerifyTitle
>>     nk\gtest1.xml:30:  with (description="we should see the login
>>     title", taskName="verifyTitle", text="Login Page")
>>
>>     Good luck.
>>
>>
>>     John and Pip wrote:
>>>
>>>     Hi,
>>>
>>>     I have a test that is failing to follow a 302 error. I've
>>>     searched the archives and played around trying to enable
>>>     redirects but nothing seems to work.
>>>
>>>     Below is the stripped-down test (just one invoke) and the
>>>     output. This is a publicly available page so you can hit
>>>     https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do
>>>     from either IE or Firefox so I'm hoping someone can help me
>>>     figure out how to hit this page from WebTest! Note that I've
>>>     tried an internal page that is http rather than https and get
>>>     the same problem so it isn't related to SSL.
>>>
>>>     I am using Java 1.5.0.6 <http://1.5.0.6>, HTMLUnit 1.10 and
>>>     WebTest R_1393 (I think! How can I verify this?).
>>>
>>>     Regards,
>>>
>>>             John
>>>
>>>     <?xml version="1.0"?>
>>>
>>>     <!DOCTYPE project SYSTEM "WebTest.dtd">
>>>
>>>     <project name="OLH" basedir="." default="main">
>>>
>>>         <property name="webtest.home" location="..\.."/>
>>>
>>>         <import file="${webtest.home}/lib/taskdef.xml"/>
>>>
>>>         <target name="main">
>>>
>>>                 <webtest name="ISIS SFF NZ Search">
>>>
>>>                             <steps>
>>>
>>>                                                     <invoke
>>>     description="ISIS SFF NZ search page" url="
>>>     https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do"
>>>     />                                               
>>>
>>>                                         </steps>
>>>
>>>                             </webtest>
>>>
>>>                 </target>
>>>
>>>     </project>
>>>
>>>      
>>>
>>>     Here is the output:
>>>
>>>      
>>>
>>>     <?xml version="1.0" encoding="UTF-8"?>
>>>
>>>     <summary Implementation-Title="Canoo Webtest"
>>>     Implementation-Version="R_1389">
>>>
>>>         <testresult endtime="Fri Nov 17 09:25:42 NZDT 2006"
>>>
>>>             location="F:\WebTest\doc\ISIS\tempTest.xml:7: "
>>>     starttime="Fri Nov 17 09:25:40 NZDT 2006"
>>>
>>>             successful="no" testspecname="ISIS SFF NZ Search">
>>>
>>>             <config>
>>>
>>>                 [snipped because I give the full URL below – get
>>>     same result if set up config properly including port 443]
>>>
>>>             </config>
>>>
>>>             <results>
>>>
>>>                 <step>
>>>
>>>                     <parameter name="description" value="ISIS SFF NZ
>>>     search page"/>
>>>
>>>                     <parameter name="method" value="GET"/>
>>>
>>>                     <parameter name="resultFilename"
>>>     value="response_1163708742276_invoke.html"/>
>>>
>>>                     <parameter name="taskName" value="invoke"/>
>>>
>>>                     <parameter name="url"
>>>     value="https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do
>>>     <https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do>"/>
>>>
>>>
>>>                     <result>
>>>
>>>                         <failed duration="1469"/>
>>>
>>>                     </result>
>>>
>>>                     <htmlparser>
>>>
>>>                         <error col="1" line="1" url="
>>>     https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do">Empty
>>>     document.</error>
>>>
>>>                     </htmlparser>
>>>
>>>                 </step>
>>>
>>>                 <failure
>>>     message="com.canoo.webtest.engine.StepFailedException:
>>>     Step[invoke &quot;ISIS SFF NZ search page&quot; (1/1)]: HTTP
>>>     error 302, at: invoke, Step: InvokePage at
>>>     F:\WebTest\doc\ISIS\tempTest.xml:9:  with
>>>     (description=&quot;ISIS SFF NZ search page&quot;,
>>>     method=&quot;GET&quot;,
>>>     resultFilename=&quot;response_1163708742276_invoke.html&quot;,
>>>     taskName=&quot;invoke&quot;,
>>>     url=&quot;https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do&quot
>>>     <https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do&quot>;)"/>
>>>
>>>             </results>
>>>
>>>         </testresult>
>>>
>>>     </summary>
>>>
>>>      
>>>
>>

--------------000402010908030803040502
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=windows-1252"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I'm not a great expert, just an average user, but *I* can't see
anything in the url that I would expect to baulk webtest.<br>
(I think) the key here is that your url is immediately redirected by
the server to another page yes?  hence the 302, which is handled
without notification to the user by the average browser.  But webtest
parks at the 302 (correctly because it is the honest truth!) and
doesn't process the redirect and further?  So what you want to do is
nudge it on the next step down the track, which a normal browser would
do silently, and process the 302 redirect's target page.   No *I* don't
know how to do this offhand, but hopefully we've clarified your problem
and requirement  (if not please correct this description!) and I
imagine one of the gurus will come online sometime in the next few
hours and either toss a solution at you or declare it a shortfall.<br>
No under no circumstances is webtest intended to be useable only by
java coders, though it is perhaps starting to rely on people being able
to slip in snippets of groovy lately where in the (distant) past it was
all declarative xml.<br>
How are those icebergs going over there?  Keep them over there won't
you, we don't want them sailing up the Brisbane river!<br>
Rob<br>
<br>
<br>
on 17/11/06 08:50 Charlie Kuharski said the following:
<blockquote cite="mid455CEB27.9000905@nmdp.org" type="cite">
  <meta content="text/html;charset=windows-1252"
 http-equiv="Content-Type">
Reaching via a browser is fine.  I can see it also.  Know that WebTest
is build upon the HtmlUnit's API.  <br>
As far as being reachable via HtmlUnit, this is only a guess, but I'm
guessing the URL is passed through to be used by HtmlUnit.  So I'm
guess it's the culprit.  There is a slight chance it's WebTest mangling
the name somehow, but I doubt it.  Wouldn't know for sure until someone
looks at the source.<br>
Try using the IP address instead.<br>
  <br>
John and Pip wrote:
  <blockquote
 cite="midc8ebe1c0611161438g5d171bc0m69f13f759e5bb9a0@mail.gmail.com"
 type="cite">Hi Charlie,<br>
    <br>
Thanks for your response.<br>
    <br>
Do you mean you couldn't reach <span class="e"
 id="q_10ef2dc88d89947b_1"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"></span></font></span> <font
 face="Arial" size="2"><a
 href="https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do</a></font>
from a browser or that you think WebTest believes it is not reachable?
This is the main public URL of the Air New Zealand flight booking
engine, and we have a screen up in the office showing bookings coming
through every minute! <br>
    <br>
re testing with HTMLUnit: I'm not a java programmer - just a tester,
trying to figure out whether I need to be a java programmer to use
WebTest!<br>
    <br>
Thanks for the hint re version number. I see this is R_1389. In fact to
my embarrassment I see this even appears in my email below! <br>
    <br>
regards,<br>
         John<br>
    <br>
    <div><span class="gmail_quote">On 11/17/06, <b
 class="gmail_sendername">Charlie Kuharski</b> &lt;<a
 href="mailto:ckuharsk@nmdp.org">ckuharsk@nmdp.org</a>&gt; wrote:</span>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
      <div bgcolor="#ffffff" text="#000000">Your host is not
reachable. 
I'm guessing it HtmlUnit.  Try using
something without the "...co.nz". You could try and test with HtmlUnit.<br>
An ugly was to discover the version is to <br>
      <br>
1) replace your steps with this only: <br>
        &lt;verifyTitle<br>
          description="we should see the login title"<br>
          text="Login Page" /&gt;<br>
      <br>
2) you should see something like:<br>
C:\test\Translink\gtest1.xml:12: Canoo Webtest: R_1393.<br>
Test failed.<br>
Exception raised: com.canoo.webtest.engine.StepExecutionException: No
current response available! Is previous invoke miss<br>
itle at C:\test\Translink\gtest1.xml:30:  with (description="we should
see the login title", taskName="verifyTitle", text<br>
anoo.webtest.engine.StepExecutionException: No current response
available! Is previous invoke missing?, Step: VerifyTitle<br>
nk\gtest1.xml:30:  with (description="we should see the login title",
taskName="verifyTitle", text="Login Page")<br>
      <br>
Good luck.
      <div><span class="e" id="q_10ef2dc88d89947b_1"><br>
      <br>
John and Pip wrote:
      <blockquote
 cite="http://midc8ebe1c0611161302m12525e7se1db36f108a24158@mail.gmail.com"
 type="cite">
        <div>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">Hi,<br>
        <br>
I have a test that is failing to follow a 302 error. I've searched the
archives and played around trying to enable redirects but nothing seems
to work. </span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">Below is the stripped-down test (just one
invoke) and the output. This is a publicly available page so you can
hit </span></font><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><a
 href="https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do</a></span></font>
from either IE or Firefox so I'm hoping someone can help me figure out
how to hit this page from WebTest! Note that I've tried an internal
page that is http rather than https and get the same problem so it
isn't related to SSL. <br>
        </p>
        <p>I am using Java <a href="http://1.5.0.6" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">
1.5.0.6</a>, HTMLUnit 1.10 and WebTest R_1393 (I think! How can I
verify this?).<br>
        </p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">Regards,</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">        John<br>
        <br>
&lt;?xml version="1.0"?&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">&lt;!DOCTYPE project SYSTEM "WebTest.dtd"&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">&lt;project name="OLH" basedir="."
default="main"&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">    &lt;property name="webtest.home"
location="..\.."/&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">    &lt;import
file="${webtest.home}/lib/taskdef.xml"/&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">    &lt;target name="main"&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">            &lt;webtest name="ISIS SFF NZ
Search"&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">                        &lt;steps&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">                                               
&lt;invoke description="ISIS SFF NZ search page" url="<a
 href="https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do</a>"
/&gt;                                                </span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">                                   
&lt;/steps&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">                        &lt;/webtest&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">            &lt;/target&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">&lt;/project&gt;</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;"> </span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;">Here is the output:</span></font></p>
        <p><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;"> </span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">&lt;?xml version="1.0"
encoding="UTF-8"?&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">&lt;summary
Implementation-Title="Canoo Webtest" Implementation-Version="R_1389"&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">    &lt;testresult
endtime="Fri Nov 17 09:25:42 NZDT 2006"</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">       
location="F:\WebTest\doc\ISIS\tempTest.xml:7: " starttime="Fri Nov 17
09:25:40 NZDT 2006"</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">        successful="no"
testspecname="ISIS SFF NZ Search"&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">        &lt;config&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">            [snipped
because I give the full URL below – get same result if set up config
properly including port 443]</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">        &lt;/config&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">        &lt;results&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">            &lt;step&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;parameter name="description" value="ISIS SFF NZ search page"/&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;parameter name="method" value="GET"/&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;parameter name="resultFilename"
value="response_1163708742276_invoke.html"/&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;parameter name="taskName" value="invoke"/&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;parameter name="url" value="<a
 href="https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do
        </a>"/&gt;</span></font> </p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;result&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">                   
&lt;failed duration="1469"/&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;/result&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;htmlparser&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">                   
&lt;error col="1" line="1" url="<a
 href="https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do</a>"&gt;Empty
document.&lt;/error&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">               
&lt;/htmlparser&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">            &lt;/step&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">            &lt;failure
message="com.canoo.webtest.engine.StepFailedException: Step[invoke
&amp;quot;ISIS SFF NZ search page&amp;quot; (1/1)]: HTTP error 302, at:
invoke, Step: InvokePage at F:\WebTest\doc\ISIS\tempTest.xml:9:  with
(description=&amp;quot;ISIS SFF NZ search page&amp;quot;,
method=&amp;quot;GET&amp;quot;,
resultFilename=&amp;quot;response_1163708742276_invoke.html&amp;quot;,
taskName=&amp;quot;invoke&amp;quot;,
url=&amp;quot;<a
 href="https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do&amp;quot"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://flightbookings.airnewzealand.co.nz/isbook_en_NZ/book/initSearchForFlights.do&amp;quot
        </a>;)"/&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">        &lt;/results&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">    &lt;/testresult&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">&lt;/summary&gt;</span></font></p>
        <p><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"> </span></font></p>
        </div>
      </blockquote>
      </span></div>
      </div>
    </blockquote>
    </div>
    <br>
  </blockquote>
</blockquote>
</body>
</html>

--------------000402010908030803040502--