Writing UI automation tests
To verify the correctness of our application on physical devices, we need to delve into user interface automation. These tests focus more on the interaction with your app and the verification of correct results rather than verifying the internal logic of the application. A test looks more like a collection of interactions with the app's widgets instead of it directly dealing with models, views, controllers, and the like. Checking for the proper result looks more like ensuring whether certain widgets are displayed on the screen rather than if an object has a specific property.
Although the goals of automation testing are the same as code testing, you do have to approach the tests from a different perspective. While testing your code directly, you have access to the objects that your code creates and you can interact with them easily. While testing your app via automation, you have to approach your app from the perspective of the user: what buttons should be pressed...