In Chapter: Testing
Author: Ian Darwin ('idarwin')
Test early and often is a common cry among advocates of testing. As is the all-important question "If you don't have a test, how do you know your code works?"
There are many types of testing. Unit Testing checks out individual components in isolation (not hitting the network or the database). JUnit and TestNG are the leading frameworks here. Mock Objects are used where interaction with other components is required; there are several good mocking frameworks for Java.
Android provides an Application Testing facility. We have a recipe on it 3352 here.
Android's popularity, and the complexity of apps, ensures that there will be many
testing frameworks developed for Android.
Third-party testing frameworks include those shown in Table 1.
If you know of others, please leave a comment on this Recipe or send an email
to the site administrator; thanks!
The terms NPE, ANR, and FC are used without further explanation in this
chapter. NPE is a "traditional Java" acronym for Null Pointer
Exception. ANR is an Android-specific acronym; it stands for
Application Not Responding, the first few words of a dialog you get when your
application is judged by Android to be taking too long to respond to a request. FC
stands for Force Close, which occurs when Android requests that you close a