I don't see mocks for SQLiteDatabase or Cursor in android.test.mock. I want to test my data model without using the actual database. I tried using EasyMock to do that, but it flunked Verify on the emulator. I tried creating my own stub, but the default constructor for SQLiteDatabase wasn't visible, and the super's parameterized constructor tried to open an actual database.
Is there a way to do what I want? On Jun 8, 11:01 pm, Brett Chabot <brettcha...@android.com> wrote: > Responses inline > > On Sat, Jun 6, 2009 at 6:11 AM, RedMac G<redm...@gmail.com> wrote: > > > JUnit -- android.jar has its own junit.jar and my assumption is you're > > supposed to use it, not the latest version from junit.org > > There's a collection of helper test classes in android.test package as > well. For example, if your test needs access to a Context, you can use > AndroidTestCase. If you want your test to have access to > Instrumentation, which will allow it to launch activities, inject key > events, etc, then you an use one of the subclasses of > InstrumentationTestCase. > > The ApiDemos/tests sample code has some test examples. > > > Mockito -- read this one > >http://code.google.com/p/mockito/issues/detail?id=57 > > See android.test.mock for a selection of frameworks for creating > Mocks. It includes mock versions of Application, Context, > ContentResolver, PackageManager, and other commonly used Android > classes. > > > EclEmma -- doesn't support Android JUnit tests > > I'm working on supporting Emma code coverage on Android. The support > is still pretty rough, I wouldn't recommend trying it as this point > unless you are really keen. I posted info on getting Emma code > coverage data when running tests on Android on a earlier thread in > this group. It would be cool to hook into EclEmma as well but there > are no definite plans for that. > > Regards, > Brett. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---