Hi guys,

First: thanks for a great platform in Android. Being able to write
Android apps in regular Java is a huge win.

However, I am confused about unit testing Android apps. Many of the
'best practices' seem to boil down to 'split your business logic off,
and test it separately using JUnit'. This is great as far as it goes.
And I understand that truly testing the UI will require firing up the
emulator.

But it seems there is a category of UI tests that I should be able to
run without the emulator. The various Mockxxx classes seem to be going
a long way towards this. But why (oh why oh why!) do they all...

    throw new RuntimeException( "Stub!" );

...in their constructors? I can understand them doing this in their
METHODS (then I could subclass them as needed) but why their
constructors? I cannot stop this functionality so I cannot do (limited
but useful) UI tests such as...

public TextView createTextView( Context context )
{
   return new TextView( context );
}

public void testCreateTextView()
{
   MockContext context = new MockContext();
   assertTrue( createTextView( mockContext ) instanceof TextView );
}

...which I would dearly love to be able to do!

Regards,

Richard.



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