I have a GWT application with multiple server-side servlets. I would like to test these servlets (without having to do GUI tests with Selenium or any other web platform). Or, in other words, I want the test to simulate the client side of GWT.
Natural problems when testing servlets are:
- Web server launch
- Customer modeling
- Servlets return immediately, passing the value to the AsyncCallback object.
So far I have managed to find out (although this has not yet been verified) that: 1. I can start the container by expanding GWTTestCase 3. I found a google doc on asynchronous testing , so you can expect an asynchronous callback. Google docs also mention the following:
Server side testing
The tests described above are intended to aid in testing client code. GWTTestCase test case wrapper will launch a development mode session or web browser to test the generated JavaScript. On the other hand, server-side code works like native Java in the JVM without JavaScript, so there is no need to run server-side code tests using GWTTestCase as the base class for your tests. Instead, use JUnit TestCase and other related classes directly when writing tests for your code on the application server side. However, you can use GWTTestCase and TestCase for code that will be used both on the client and on the server.
But there are no examples or more detailed explanations of how to do this.
I did not understand how to simulate a client ... Any ideas how I can do this?
Or, if this is not a way to do this, is there another way? I would prefer to use my own GWT classes rather than some third-party framework for testing servlets.
Thanks!
source share