views:

107

answers:

1

Hi All,

I have question on the Android API. Android API provides a class called "Instrumentation" class. What is the use of this class? Is the Instrumentation class be used only together with Junit for unit testing.

Can Junit framework can be used to test the methods of the Android API without using the Instrumentation class.

Since Junit package has been included in the Android package, I hope we dont need to use install separately for unit testing.

I would appreciate if you could provide me the information as i can't find these clear information anywhere on the Web.

If we use Junit test framework to test the Android API, can we have test results in the UI format rather than test format.?

Thanks a lot. Apprecite your time.

Regards, Riyas

+1  A: 

The Instrumentation class allows the test case to subscribe to various application events (keypresses, etc), and also programmatically control the UI to enable functional testing of your application.

Therefore, you technically do not need the Instrumentation class for Junit testing if all you are doing is unit testing, and not functional testing of the UI. You could just extend TestCase which does not provide any Instrumentation support.

Here is a link with some fairly good descriptions of the various test classes.

Junit is included within Android and will not need to be installed separately.

Steve
thanks a lot for your reply.
Riyas
thanks for your reply.
Riyas