views:

90

answers:

1

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!

A: 

Take a look at Robotium
'a open-source test framework created to make automatic black-box testing of Android applications significantly faster and easier than what is possible with Android instrumentation tests out-of-the-box.'

Homepage: http://www.robotium.org/
Source: http://github.com/jayway/robotium

Please note that the Robotium project is maintained by the company I work for

Jonas Söderström
Jonas, thank you! I try to use your framework and it's greate! But unfortunately our company policy forbid to use any 3rd party components in our tests :(
Evgeny
Check the code for Robotium, it's open source. Maybe you can find something there that can help you.
Jonas Söderström
Jonas, is it possible to check that some toast appeared on current activity using robotium?
Evgeny
Hi Evgeny. Try using searchText, but note that it's case sensitive. If you have more robotium questions check out Robotium Google Group http://groups.google.com/group/robotium-developers
Jonas Söderström