Hi Vivian,

"application/vnd.mozilla.xul+xml" should surely be parsed as xml, but
this wouldn't allow you to perform a
     <verifyTitle
           description="we should see the login title"
           text="Login Page" />
on it.

VerifyTitle works only on "html" pages. You can try to force HtmlUnit to
see "application/vnd.mozilla.xul+xml" as html for instance this way (as
first step of your <webtest>):

<groovy>
import com.gargoylesoftware.htmlunit.DefaultPageCreator

class MyPageCreator extends DefaultPageCreator
{
  protected String determinePageType(final String contentType)
  {
    if ("application/vnd.mozilla.xul+xml".equals(contentType)
      return "html";
    else
      return super.determinePageType(contentType)
  }
}
step.context.webClient.pageCreator = new DefaultPageCreator()
</groovy>

(note that this simple customization will remove the PDF features in
recent builds - post release 2.5 -).

Nevertheless I doubt that it will give good results as XUL pages and
HTML pages differ too much. Let us now what you achieve.

Marc.

Vivian Guo wrote:
> Hi Marc, 
> 
> Thanks for replying. I pasted the SimpleTest.xml
> content below. It is quite simple, just to verify I
> can use WebTest to verify the response page. 
> I think WebTest should work if it treats
> "application/vnd.mozilla.xul+xml" just as xml page. I
> find this ( actually it is your post) 
> http://lists.canoo.com/pipermail/webtest/2005q3/004271.html
> and think your solution should work for us too. Maybe
> I don't have the right version of htmlunit? 
> 
> Vivian
> -------------------SimpleTest.xml----------------
> <project name="SimpleTest" basedir="." default="main">
> 
>   <property name="webtest.home"
> location="C:/CanooWebTest" />
>   <import file="${webtest.home}/lib/taskdef.xml"/>
> 
>   <target name="main">
>     <webtest name="myTest">
>       <config 
>         host="<host>"
>         port="8121"
>         protocol="http"
>         basepath="booking" >
> <header 
>       name="User-Agent" 
>       value="Mozilla/5.0 (Windows; U; Windows NT 5.1;
> en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"/>
> </config>
> 
>       <steps>
>         <invoke 
>           description="get Login Page"
>           url="faces/iter_07/Login.jsp" />
>         <verifyTitle 
>           description="we should see the login title"
>           text="Login Page" />
>       </steps>
>     </webtest>
>   </target>
> </project>
> 
> 
> 
> 
> --- Marc Guillemot <[EMAIL PROTECTED]> wrote:
> 
>> Hi Vivian,
>>
>> xul applications are not really the focus of WebTest
>> nevertheless I
>> guess that it could be used to some extend for this
>> purpose too.
>>
>> What do you want to do in the page you invoked?
>>
>> Marc.
>> -- 
>> Blog: http://mguillem.wordpress.com
>>
>>
>> Vivian Guo wrote:
>>> Hi, 
>>>
>>> I am new to WebTest and currently testing a xul
>>> applicaiton. I run into this error and pretty much
>>> stuck now. Can someone help please?  Thank you so
>> much
>>> !  
>>>
>>>
>>>
>>> -Vivian
>>>
> -----------------------------------------------------
>>> [verifyTitle]  INFO (com.canoo.webtest.steps.Step)
>> -
>>>>>>> Start Step: verifyTitl
>>> e "we should see the login title" (2/2)
>>> [verifyTitle]  INFO (com.canoo.webtest.steps.Step)
>> -
>>> Running with: Canoo Webtest
>>> : R_1551.
>>> [verifyTitle]  INFO (com.canoo.webtest.steps.Step)
>> -
>>> Exception thrown from this
>>> class:
>> com.canoo.webtest.engine.StepExecutionException
>>> [verifyTitle]  INFO (com.canoo.webtest.steps.Step)
>> -
>>> Message was: Current respon
>>> se is not an HTML page but of type
>>> application/vnd.mozilla.xul+xml
>>>  INFO (com.canoo.webtest.steps.Step) - Running
>> with:
>>> Canoo Webtest: R_1551.
>>>  INFO (com.canoo.webtest.steps.Step) - Exception
>>> thrown from this class: com.can
>>> oo.webtest.engine.StepExecutionException
>>>  INFO (com.canoo.webtest.steps.Step) - Message
>> was:
>>> Current response is not an H
>>> TML page but of type
>> application/vnd.mozilla.xul+xml
>>>  INFO (com.canoo.webtest.ant.WebtestTask) -
>> Finished
>>> executing webtest "myTest"
>>> (C:\CanooWebTest\SimpleTest.xml:7: )
>>>
>>> BUILD FAILED
>> _______________________________________________
>> WebTest mailing list
>> [email protected]
>> http://lists.canoo.com/mailman/listinfo/webtest

-- 
Blog: http://mguillem.wordpress.com

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to