When to use TestCase, InstrumentationTestCase or AndroidTestCase

by Mihai Fonoage » Wed, 03 Mar 2010 02:39:48 GMT

Sponsored Links
 Hi navin,

would use ActivityInstrumentationTestCase2; for testing some part of
your activity in isolation you would use an InstrumentationTestCase;
for unit testing, if you use JUnit 4.x version, you just need to
annotate your class methods appropriately (don't need to extend/
implement anything).

I have some examples (and some additional details) of all this if it

Mihai Fonoage


When to use TestCase, InstrumentationTestCase or AndroidTestCase

by navin » Wed, 03 Mar 2010 18:23:31 GMT

 Hi Mihai,

Thanks for the post, it did helped. And also your post on the unit and
functional testing..that was very helpful. In any chance have you
developed any test case and included in CTS?? also if you can explain
something about AndroidTestCase class and why specifically use it when
we have the InstrumentationTestCase and
ActivityInstrumentationTestCase2...i want to include my test case in
CTS package and then compile the whole package..if you have any idea
regarding the same..please do reply.



Sponsored Links

Other Threads

1. Math Display, Data efficiency, why no pre-populated db in apk?

As the subject says, i have quite a few questions i was hoping to get
an answer too:

1) Displaying math notations: There seems to be no support for
displaying math equations. How can we handle this? Generating an image
on server and sending it to the app seems like a hammer for a fly? I
tried adding <sup></sup> which shows superscripts but we cannot use
&radic for square roots. Any insights are deeply appreciated.

2) What is the most efficient way to handle relational data? The
dictionary example puts stuff in a text file and populates it in
sqllite db at runtime, this seems very counter intutive, what is the
reason for that and why can't we copy the DB and store it as some
example on the web suggest? What are the performance implications?

3) Best solution for hosting services (any free ones)?


2. Bitmap.createBitmap vs. Decodestream alpha performance


I'm loading transparent PNGs into bitmaps using two different methods.
The first being BitmapFactory.decodeStream() of a resource stream. The
second being Bitmap.createBitmap(), populated by a Bitmap.setPixels()

When drawn on a canvas, the bitmaps loaded by decodeStream() perform
significantly better. At first I thought the difference might be due
to using a createBitmap() overload that returns a mutable bitmap, but
changing it to return an immutable bitmap did not cover the difference
in performance.
Calling getConfig() on the bitmaps returned by decodeStream() returns
null, could the bitmap have been converted to an ARGB1555 or similar
format internally? Is it possible to get the same configuration using
createBitmap() with setPixels()?

// Method A ~55FPS
BitmapFactory.Options sBitmapOptions
        = new BitmapFactory.Options();
sBitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;
InputStream is = context.getResources().openRawResource(resource_id);
Bitmap bitmap = BitmapFactory.decodeStream(is, null, sBitmapOptions);

// Method B ~45FPS
Bitmap bitmap = Bitmap.createBitmap(width, height,
int length = (width*height);
int[] arrColor = new int[length];
// fill arrColor
bitmap.setPixels(arrColor, 0, width, 0, 0, width, height);



3. How to simulate a (missing) DPADt

4. switch camera to video error

5. Hello Localization

6. Problem adding sensor library for new device

7. Data is not displaying in lin