Thanks for starting this thread.  I have my Junit tests working,
including my datastore tests, but I have a question regarding project
setup.  I suppose this is more of an Eclipse question than anything
else, but perhaps you can help.  I've worked in NetBeans prior, and I
can setup a 'test' folder with my unit test source.  These classes are
excluded from the final war file. However, when I create a test folder
at the same level as my source folder:

Project
- src
- test

the only way I can make my tests work is to include test as a source
folder and add all the testing jars to my normal build path.  This
means my test classes end up in the deployment.

Can I have my tests in the same project as my source, or do I need to
have a separate project?

Thanks for you help.



On Feb 11, 10:43 am, Krishna Caldas <[email protected]> wrote:
> Yes, I missed that method.
> Maybe add this little trick on tutorial for now!?
>
> Krishna
>
> 2010/2/11 Max Ross (Google) <[email protected]>:
>
>
>
> > Great, glad to hear it!  I forgot to add a method to LocalServiceTestHelper
> > to set a custom app id.  My mistake.  I'll make sure this gets added for the
> > next release so you don't need to provide your ownEnvironment
> > implementation.
>
> > Max
>
> > On Thu, Feb 11, 2010 at 10:30 AM, Krishna Caldas <[email protected]>
> > wrote:
>
> >> You're right!
> >> I refactored my code and forget to annotate the new setUp method with
> >> @Before.
> >> Sorry for taking your time! It works now.
>
> >> Thanks,
> >> Krishna
>
> >> 2010/2/11 Max Ross (Google) <[email protected]>:
> >> > Your code looks fine.  Are you sure you're calling setUp() on the
> >> > LocalServiceTestHelper?
>
> >> > On Thu, Feb 11, 2010 at 10:11 AM, Krishna Caldas
> >> > <[email protected]>
> >> > wrote:
>
> >> >> Ooops.. missed your question!
> >> >> It's just:
> >> >>        @Override
> >> >>        protectedEnvironmentnewEnvironment() {
> >> >>                return new TestEnvironment();
> >> >>        }
>
> >> >> Thanks,
> >> >> Krishna
>
> >> >> 2010/2/11 Max Ross (Google) <[email protected]>:
> >> >> > Subclassing LocalServiceTestHelper and overriding newEnvironment()
> >> >> > should
> >> >> > work fine.  What does your implementation of newEnvironment() look
> >> >> > like?
>
> >> >> > On Wed, Feb 10, 2010 at 7:35 PM, Krishna <[email protected]>
> >> >> > wrote:
>
> >> >> >> Ok!
>
> >> >> >> But when I'm using transactions I'm getting:
>
> >> >> >> java.lang.NullPointerException:NoAPIenvironmentisregisteredfor
> >> >> >> thisthread.
> >> >> >>        at
>
> >> >> >> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(Datas
> >> >> >>  toreApiHelper.java:
> >> >> >> 67)
> >> >> >>        at
>
> >> >> >> com.google.appengine.api.datastore.DatastoreServiceImpl.beginTransaction(Da
> >> >> >>  tastoreServiceImpl.java:
> >> >> >> 270)
>
> >> >> >> I've tried to extend LocalServiceTestHelper and overwrite
> >> >> >> newEnvironment()  with myEnvironment(who returns appId) but it
> >> >> >> didn't work...
>
> >> >> >> What's wrong?
>
> >> >> >> Thanks,
> >> >> >> Krishna
>
> >> >> >> On Feb 10, 10:25 pm, "Ikai L (Google)" <[email protected]> wrote:
> >> >> >> > We've got a more simple interface for you now. Take a look:
>
> >> >> >> >http://code.google.com/appengine/docs/java/tools/localunittesting.html
>
> >> >> >> > 2010/2/10 时空之蕊 <[email protected]>
>
> >> >> >> > > I found the class
> >> >> >> > > com.google.appengine.tools.development.ApiProxyLocalImpl is not
> >> >> >> > > public,but before 1.3.1 it's public!
> >> >> >> > > In the JUnit document:
>
> >> >> >> > > import java.io.File;
> >> >> >> > > import com.google.appengine.tools.development.ApiProxyLocalImpl;
> >> >> >> > > import com.google.apphosting.api.ApiProxy;
>
> >> >> >> > > ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
>
> >> >> >> > > So I can't new a ApiProxyLocalImpl instance!
> >> >> >> > > Any body know how to use JUnit?
> >> >> >> > > 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]<google-appengine-java%2B
> >> >> >> > > [email protected]>
> >> >> >> > > .
> >> >> >> > > For more options, visit this group at
> >> >> >> > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> >> >> >> > --
> >> >> >> > Ikai Lan
> >> >> >> > Developer Programs Engineer, Google App
>
> >> >> >> > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine
>
> >> >> >> --
> >> >> >> 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.
>
> >> >> > --
> >> >> > 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.
>
> >> >> --
> >> >> 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.
>
> >> > --
> >> > 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.
>
> >> --
> >> 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.
>
> > --
> > 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.

-- 
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.

Reply via email to