Koert- Instead of looking at Instrumentation.html, I would recommend focusing (for now) on the Junit-based test environment that is already set up for what you are trying to do.
InstrumentationTestCase is a good place for writing tests that work mainly by manipulating the UI (e.g. "when I click this button, make sure X happens"). ActivityInstrumentationTestCase is similar, but focuses on a single Activity giving you more direct access to the Activity (e.g. "when I click this button, make sure that this method returns value Y"). As Dianne alluded to, neither of these is a true Unit Test because Activities are just too tied into the system to do much on their own. There *is* a unit test case fixture, ActivityUnitTestCase, that creates your Activity "in isolation". But it is very limited, due to the tight integration already noted, and it doesn't get used very much. Be sure to check out the unit test examples in the ApiDemos package. Hope this helps, Andy On Tue, Jan 13, 2009 at 4:37 AM, Koert <[email protected]> wrote: > > I have been developing an Android application and I keep wishing some > king of dependency injection would be possible to make unit testing a > bit easier. And I mean unit testing in the Eclipse IDE, not > integration testing on the emulator or phone itself. > > I have been experimenting with reflection and I can make a simple kind > of dependency injection working. > > It would be very nice if I could inject the dependencies into an > Activity as it is created. I was looking at the instrumentation > configuration in the manifest, thinking that I could configure some > kind of interceptor that could enrich the Activity after creation and > before it was started. > > See: > http://code.google.com/android/reference/android/app/Instrumentation.html > > http://code.google.com/android/devel/bblocks-manifest.html > > However, I cannot figure out how to make it work; any suggestions how > I might make it work? > > Thanks, > Koert Zeilstra > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

