Re: I need to test the onError method of RequestCallback

2010-04-01 Thread Thomas Broyer


On Mar 31, 11:32 pm, jayaprasad vishwanathan jpforj...@gmail.com
wrote:
 Thanks
 Thomas, I managed to do it already, with the same way, given a sleep in the
 servlet.
 Now another issue , I am trying to crack is I have to use this mode for
 running test in production mode

 -runStyle Manual:1
 when I run it , get the url , past in browser getting disconnected ,
 The problem is there is a servlet generate a picture and return
 ind devmode url is this -http://127.0.0.1:/test/NVM_hover_bg.png
 but in test mode it is searching a servlet By this 
 urlhttp://192.168.1.3:1627/com.test.client.test.JUnit/pic.png
 and getting disconnected since its not able to get this servlet.
 Could u please help me in this issue,

In GWTTestCase, servlets have to be declared in a .gwt.xml using the
servlet/ element, and called using a path relative to
GWT.getModuleBaseURL() (or GWT.getHostPageBaseURL() if you want,
they'll be the same during tests)
You can either declare the servlet/ in your module's gwt.xml or
create a new gwt.xml just for the tests, that inherits/ your app
module and declare the servlet/ (make sure your
GWTTestCase.getModuleName() returns the test-specific module).
Again, have a look at how it's done in GWT's own tests (see links in
my previous message, and sibling files and packages)

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



I need to test the onError method of RequestCallback

2010-03-31 Thread jp
Hi all ,
In gwt test case I have to make an an ajax call using RequestBuilder ,
Need to test the onError method on RequestCallback
is executed or not if we provide a wrong URL, I tried setting the
status or response,
tried many ways the onError method is not executed
Please help me
thanks
JP

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: I need to test the onError method of RequestCallback

2010-03-31 Thread Thomas Broyer


On 31 mar, 13:39, jp jpforj...@gmail.com wrote:
 Hi all ,
 In gwt test case I have to make an an ajax call using RequestBuilder ,
 Need to test the onError method on RequestCallback
 is executed or not if we provide a wrong URL, I tried setting the
 status or response,
 tried many ways the onError method is not executed
 Please help me

There are very few cases when onError would be called, the most common
one being a timeout if you call setTimeoutMillis with a non-0 value.

The easy way to reliably have it is to Thread.sleep() on the server
side with a long value while having a short timeout on the client
side. Maybe GWT's own unit tests could inspire you?
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/test/com/google/gwt/http/client/RequestBuilderTest.java#389
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/test/com/google/gwt/http/server/RequestBuilderTestServlet.java#66
(note that it won't run reliably in -runStyle:HtmlUnit due to a but in
HtmlUnit)

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: I need to test the onError method of RequestCallback

2010-03-31 Thread jayaprasad vishwanathan
Thanks
Thomas, I managed to do it already, with the same way, given a sleep in the
servlet.
Now another issue , I am trying to crack is I have to use this mode for
running test in production mode

-runStyle Manual:1
when I run it , get the url , past in browser getting disconnected ,
The problem is there is a servlet generate a picture and return
ind devmode url is this - http://127.0.0.1:/test/NVM_hover_bg.png
but in test mode it is searching a servlet By this url
http://192.168.1.3:1627/com.test.client.test.JUnit/pic.png
and getting disconnected since its not able to get this servlet.
Could u please help me in this issue,
Thanks
JP




On Thu, Apr 1, 2010 at 2:50 AM, Thomas Broyer t.bro...@gmail.com wrote:



 On 31 mar, 13:39, jp jpforj...@gmail.com wrote:
  Hi all ,
  In gwt test case I have to make an an ajax call using RequestBuilder ,
  Need to test the onError method on RequestCallback
  is executed or not if we provide a wrong URL, I tried setting the
  status or response,
  tried many ways the onError method is not executed
  Please help me

 There are very few cases when onError would be called, the most common
 one being a timeout if you call setTimeoutMillis with a non-0 value.

 The easy way to reliably have it is to Thread.sleep() on the server
 side with a long value while having a short timeout on the client
 side. Maybe GWT's own unit tests could inspire you?

 http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/test/com/google/gwt/http/client/RequestBuilderTest.java#389

 http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/test/com/google/gwt/http/server/RequestBuilderTestServlet.java#66
 (note that it won't run reliably in -runStyle:HtmlUnit due to a but in
 HtmlUnit)

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-tool...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.