You can and should write normal unit tests for everything in your app that doesn't depend on the Android-specific APIs.
It's a good idea to try to keep the android-specific stuff and the non- android-specific functionality as separate as possible. Not only does it aid testing, it aids porting to other platforms (say, a companion desktop app, or migrating some of the functionality to a server). I'm not entirely happy with what I've come up with so far for running android-specific unit tests on the platform (emulator or device) as part of an automated build procedure. But running non-android tests in the JVM as part of the build gets you a lot of the benefit -- how much I think will depend on the nature of your application. An app that's all forms and no function (say, a data entry app) will probably derive relatively little benefit from the non-Android test -- and even little benefit for the Android-specific ones. Integration and UI testing may be where most of the testing benefit is to be found. A calculator app with a simple UI but a lot of functionality, could benefit greatly from standard JVM-based unit testing. On Nov 9, 2:21 pm, Frank Weiss <[email protected]> wrote: > You've raised a good question. It's correct to to say that a unit test does > not involve all the classes of an application. Unit tests are also supposed > to run very quickly. We also usually don't include the GUI in unit tests. > Neither external web services. > > In Android, though, we have a bit of a problem. To really run even by the > book unit tests, we'd have to either run them on the JVM or the DVM. In the > first case, we would be using .class files, in the latter case, .dex files. > But I don't know if we have DVM for anything but the emulator or the device. > And the emulator's DVM tends to run slow. Hmmm. > > I would tend to agree that what is called unit testing in the Android SDK is > a bit different than the norm. I'd like to hear what others have to say. -- 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

