Hi Alex, Thanks for your valuable input. I'll take a look at Mockito.
Kind regards, Chris On Sunday, August 19, 2012 7:43:34 PM UTC+2, alex wrote: > > I never used Jersey but what we're doing in this kind of testing is simply > mocking (HttpServletRequest)request.getInputStream() and a couple other > methods so that they would operate on payloads provided within the unit > tests or files on a disk, and (mocked) Response would write to a string > (instead of real HTTP communication). > > Nice thing about this is the tests are run really fast as no external > processes (e.g. dev server) are launched during testing. Plus, Testbed is > always available in case there's a need to check some internal states. > Also, the only external lib dependency (testing-wise) with which we mock > classes like HttpServletResponse is Mockito. > > > On Sunday, August 19, 2012 2:54:40 PM UTC+2, Christopher Armstrong wrote: >> >> Hello, >> >> I'm currently developing an application in Java and want to use >> AppEngine. My setup uses Jersey JSON/REST to exchange data between the >> client and the server. >> >> I would like to do following in the development mode with JUnit: >> * Start AppEngine >> * Execute Tests >> * Stop AppEngine >> >> I have had two threads open on Stackoverflow. First thread was how I can >> start AppEngine over Junit without spawning threads so that I can test my >> REST resources. I have been told that this is an integration test and Junit >> can't be used for that. I should try to test by executing the methods of >> the resource class directly. Ok, I was thinking but it is somehow funny >> because when reading the Jersey docs they suggest exactly this. Starting a >> webserver to test the REST resources with Junit. >> >> I tried then to execute the methods directly and this worked at least for >> the getStatus() method from the Response class. But when I execute the >> methods directly and want to use getEntity() method of the Response class I >> can't marshal the object back in to the entity class. So this isn't working >> either out of some reason and I'm unable get the created record back so >> that I have the contents. >> >> Is there any best practice provided by Google to test REST interfaces in >> an automated manner or does anybody know how to test jersey resource >> classes properly (without curl on the command line)? >> >> Its nice that I'm doing it all wrong and that Junit has nothing to do >> with Integration testing but somehow I need to test my classes. It would be >> great if somebody could give me a hint. >> >> Thanks, >> Chris >> >> -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/QUSbaf8biHgJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
