I have read the AppEngine unit testing guidelines, and I got the Java Datastore service tests working, but I'm not having any luck with the Channel service. The guide doesn't give any specific examples for channel testing, and the javadocs aren't of much help either, but my IDE is showing me some classes that seem to be meant for unit testing a local channel service; I just can't figure out how to use them.
Does anyone have any experience or examples testing the GAE Channel Service?
Have you seen the example at http://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/appengine/tools/development/testing/LocalChannelServiceTestConfig.java?r=182
Oops sorry for the previous post, I realized you aren't doing capabilities...
Ivan provided neat Python example, here's a solution for Java.
Supppose here's the code we want to test
First, add
appengine-testing.jar
to the classpath:Next, create a test as follows. I'm assuming JUnit here, but generaly you are free to use any test framework, it doesn't matter for GAE.
The following has worked for me:
You can also look at the source code for the channel service stub.