"There are APIs to allow you to run code on the main thread to access
its objects." I'm a little confused about what APIs you are talking
about and how they would help solve this problem. Could you clarify?

To me it seems that the test runner should not be calling my tests if
the Application is not finished initializing yet.

Andy


On Mar 4, 2:57 pm, Dianne Hackborn <hack...@android.com> wrote:
> You are calling this while the app is running, and it hasn't finished
> initializing.
>
> Generally you should be very careful about directly touching app objects
> like this from tests, since the test is running in a separate thread.  There
> are APIs to allow you to run code on the main thread to access its objects.
>
> On Wed, Mar 4, 2009 at 10:00 AM, AndyM <andrewdm...@gmail.com> wrote:
>
> > I have a simple androidTestCase class that has this test:
>
> > @MediumTest
> > public void testFoo() {
> >          assertNotNull(this.mContext.getApplicationContext());
> > }
>
> > this fails unless I sleep first, then it passes. Whats the deal?
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to