TurboManage

David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler


    Web app developer since 1994 and Google Cloud Platform Instructor now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 228 other followers

  • Sleepless Nights…

    October 2009
    S M T W T F S
    « Sep   Nov »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031
  • Blog Stats

    • 1,007,777 hits

Archive for October 19th, 2009

Unit testing the AppEngine Datastore with JDO

Posted by David Chandler on October 19, 2009

I’ll admit, I was lazy at first and didn’t write server-side unit tests for my JDO persistence methods. I was effectively doing testing via trial and error from the client, which has two drawbacks: 1) if you make a change to server-side code, you have to restart the hosted development environment, which takes a while, and 2) since GWT doesn’t know about all of JDO’s exceptions, JDO errors in server-side code are frequently masked by GWT serialization errors involving the JDOFatalUserException or some such.

Google provides a recipe for AppEngine unit testing, but their coverage of testing the Datastore is incomplete. Thankfully, AppEngineFan has solved this and published a blog post and some nice code to help test AppEngine JDO calls. All I needed was the three classes in the com.appenginefan.toolkit.unittests package. Just extend BaseTest, call the newPersistenceManager() method, and you’re off and running.

Note: this post applies to testing only in the local development environment. I doubt you can run unit tests in the AppEngine production environment, but if I’m wrong about that, please post a comment as I’d sure like to know about it.

Posted in AppEngine, Google Web Toolkit | 1 Comment »

 
%d bloggers like this: