I have a pretty good solution for you, Christian, and anyone else trying to 
do this, ie GwtTestCase plus GAE test fixtures.


First, create a myapptest.gwt.xml module file.


<module rename-to='myapptest'>

  <!-- Inherit base app.                         -->

  <inherits name='com.mycompany.myapp.myapp'/>


  <!-- Specify the paths for translatable code                    -->

  <source path='client'/>

  <source path='shared'/>


  <!-- For each service you have, point to a test service class.       -->

  <servlet path='/account' class=
'com.mycompany.myapp.server.AccountServiceTestImpl'/>

</module>


The key here is that you're pointing services to a new class.  Thankfully, 
the class is a simple subclass of the original service implementation that 
adds AppEngine test fixture initialization in the init() method.


public class AccountServiceTestImpl extends AccountServiceImpl {

private final LocalServiceTestHelper helper = new LocalServiceTestHelper(

     new LocalDatastoreServiceTestConfig(), newLocalUserServiceTestConfig())

     .setEnvIsLoggedIn(true)

     .setEnvAuthDomain("test.com")

     .setEnvEmail("t...@test.com");


 @Override

public void init() throws ServletException {

 super.init();    

 helper.setUp();

}

}


All these files sit in subdirectories of /test so you're not introducing 
fixture dependencies in your /src code.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/AELb4qfT9VkJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to