[Webtest] HTTP error 302

Paul King Paul King <paulk@asert.com.au>
Fri, 17 Nov 2006 18:29:17 +1000


Rob Manthey wrote:
> ok, a moment to learn something ... is this simply the final url (after 
> the 302 redirect) or is there something else going on here?

The default behaviour is to follow redirects. If you want to visit
the 302 page you have to turn redirects off among other things.
I guess we should document this better as it arises quite frequently.

Cheers,

Paul.

> on 17/11/06 11:49 Aarathi Niranjan said the following:
>>
>> Just a suggestion  this works for me  try it:
>>
>>  
>>
>>             
>>
>> <steps>
>>
>>                         <invoke description="ISIS SFF NZ search page" 
>> url="https://flightbookings.airnewzealand.co.nz?isbook_en_NZ?book?initSearchForFlights.do" 
>> />
>>
>>             </steps>
>>
>>             
>>
>>  
>>
>> Hope that helps.
>>
>>  
>>
>> ------------------------------------------------------------------------
>>
>> *From:* webtest-admin@lists.canoo.com 
>> [mailto:webtest-admin@lists.canoo.com] *On Behalf Of *Charlie Kuharski
>> *Sent:* Thursday, November 16, 2006 2:50 PM
>> *To:* webtest@gate2.canoo.com
>> *Subject:* Re: [Webtest] HTTP error 302
>>
>>  
>>
>> 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>
>>
>>  
>>
>>  
>>