Getapplicationcontext () Application context is associated with the applicaition and would always be the same throughout the life cycle.
Getbasecontext () should not being used just use Context instead of it which was associated with the activity and Coul D possible be destroyed if the activity is destroyed.
getapplication () is available to Activity and Services only. Although in current Android Activity and Service implementations, getapplication () and Getapplicationcontext () return the same object, there is no guarantee that this would always be the case (for example, In a specific vendor implementation). So if you want the application class you registered in the Manifest and you should never callGetapplicationcontext () and cast it to your application, because it may is the the application instance (which you obviously experienced with the Test framework).
getParent () returns object of the activity if the current view was a child. In other words returns the activity object hosting, the child view, called within the child.