Hi Sam,
I've just refactored my JUnit TestCase base class to be used
independently of JAX-RS. Take a look at project org.restlet.test (only
in SVN trunk), class
org.restlet.test.jaxrs.server.RestletServerTestCase. You don't need to
take a look into the other classes in this package.
Subclass RestletServerTestCase and wrote test* methods as for every
JUnit test. You may use #setUseTcp(true / false) to indicate, if you
want real tcp access (slow) or direct application access (sometimes only
nearly real). You may also change the initial value in
RestletServerTestCase.
You should use the accessServer methods to access the server.
So, if you don't understand the result, test with real TCP; if you found
a bug in the RestletServerTestCase, let me know, at the best with a test
case reproducing it.
The setUp() method automaticly starts the server for every method and
tearDown() will stop it. So you must ensure to call super.setUp() /
super.tearDown() if you override them.
Take a look into it and let me know, what is not clear, so I will add
more javadoc to methods with not enough javadoc ... I'll be happy about
feedback. Perhaps I can not answer the rest of today, but tomorrow I
have time for it.
best regards
Stephan
Stephan Koops wrote:
[...]
BTW: It's not required that you use a real TCP client for testing: You can give
the application directly your requests. So you save a LOT of time, because you
save the time to start the TCP-ServerSocket, serializing requests and so on.
I should refactor that out of my JAX-RS test case class, because it is combined
with services for JAX-RS testing.
best regards
Stephan