It's difficult to check for a dialog using unit tests. Keep in mind
that unit tests are supposed to test individual methods, and what
you're trying to do is at a somewhat higher level. A unit test would
test the results of clicking mLoginButton, and you don't include this
part of the code.

I am curious: is there a particular reason that you're calling
instr.addMonitor? Are you testing another Activity besides
MainActivity when you call this?

A. Elk.

On Sep 23, 11:24 pm, Eugeny kropotin <[email protected]> wrote:
> Hello, Android Developers! I have some question for you.
>
> I want to write testcases for my android application using JUnit. And
> I faced some problems.
>
> Is it possible to check that activity displays some dialog at current
> moment? Here is a small piece of my test application:
>
>     ...
>     Instrumentation instr = getInstrumentation();
>     monitor = instr.addMonitor(MainActivity.class.getName(), null,
> false);
>     /* Click on login button */
>     TouchUtils.clickView(this, mLoginButton);
>     /* wait MainActivity */
>     mMainActivity = instr.waitForMonitorWithTimeout(monitor, 3);
>     assertNotNull(mMainActivity);
>     /* Here a want to check that progress dialog displayed on
> mMainActivity */
>
> Thanks in advance!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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/android-developers?hl=en

Reply via email to