Hi Daniel,
Here is the source code I use daily on my own tests (starts all local
Services that I currently need)
You can forget Ofy.reset(): I use Objectify (must simpler and more
transparent & efficient than JDO which I started with)
public class TestCaseServer {
private
com.google.appengine.tools.development.testing.LocalServiceTestHelper
bssHelper;
private
com.google.appengine.tools.development.testing.LocalServiceTestHelper
dsHelper;
private
com.google.appengine.tools.development.testing.LocalServiceTestHelper
imgHelper;
private
com.google.appengine.tools.development.testing.LocalServiceTestHelper
userHelper;
@Before
public void setUp() {
// System.out.println("Entering @Before for TestCase" );
this.setupBlobstoreService();
this.setupDatastoreService();
this.setupImageService();
this.setupUserService();
//
Ofy.reset();
}
@After
public void tearDown() {
// System.out.println("Entering @After for TestCase");
this.removeEntities();
//this.teardownBlobstoreService();
this.teardownDatastoreService();
this.teardownImageService();
this.teardownUserService();
}
private void setupBlobstoreService() {
this.bssHelper = new
com.google.appengine.tools.development.testing.LocalServiceTestHelper(
new
com.google.appengine.tools.development.testing.LocalBlobstoreServiceTestConfig());
this.bssHelper.setUp();
}
private void setupDatastoreService() {
this.dsHelper = new
com.google.appengine.tools.development.testing.LocalServiceTestHelper(
new
com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig());
this.dsHelper.setUp();
}
private void setupImageService() {
this.imgHelper = new
com.google.appengine.tools.development.testing.LocalServiceTestHelper(
new
com.google.appengine.tools.development.testing.LocalImagesServiceTestConfig());
this.imgHelper.setUp();
}
private void setupUserService() {
this.userHelper = new
com.google.appengine.tools.development.testing.LocalServiceTestHelper(
new
com.google.appengine.tools.development.testing.LocalUserServiceTestConfig());
this.userHelper.setUp();
}
/*
private void teardownBlobstoreService() {
this.bssHelper.tearDown();
}
*/
private void teardownDatastoreService() {
this.dsHelper.tearDown();
}
private void teardownImageService() {
this.imgHelper.tearDown();
}
private void teardownUserService() {
this.userHelper.tearDown();
}
}
On Oct 22, 1:01 pm, Daniel Blasco <[email protected]> wrote:
> Hi, I'm using GAE 1.3.5 and JUnit 4.
>
> I want to test a GAE App which uses JDO. Firstly I read the "HowTo" in
> the GAE official
> site:http://code.google.com/appengine/docs/java/tools/localunittesting.html
> But there is no clues.
>
> In this pagehttp://blog.appenginefan.com/2009/05/jdo-and-unit-tests.html
> I found some instructions but, obselete I guess.
>
> Some instructions please?
>
> Thanks!
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
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-java?hl=en.