What to test
In the previous chapters, you learned about the Android testing API working with Android Studio. Apart from knowing about activity and UI testing, considering what parts of your application should be evaluated is also important.
Network access
If your application depends on the network access, you should examine the behavior of your application when different network states are given. Consider the following suggestions:
- If your application completely depends on the network when it is launched and there is no network access, it should at least show a default home screen. Your application should not show a blank screen with any information on it. Let the user know that he/she should review the device connectivity. The network state can be checked using the
ConnectivityManager
class in the following code:ConnectivityManager connManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = connManager.getActiveNetworkInfo(); if (netInfo !=...