This is the second blog post in a small series that’s meant to introduce a bit of Android App development terminology to testers. As a tester you don’t need to be an expert at app development, but knowing the basics of how apps are constructed will certainly help you make informed decisions when testing and automating.
The previous post was about Activities.
In this post I’ll tell you a little about Views.
To simplify things a bit: everything you see in the UI is basically a View. A View occupies a rectangular area on the screen and can be anything such as a Textview, Button, EditText, ImageView, ViewGroup and more. Views are arranged (how and where they are displayed on screen) in a layout. A layout (a form of ViewGroup) is an invisible container that holds other Views and defines their layout properties. Here’s an example:
In the example you can see the different Views (in the middle) and their hierarchy and type (on the left). If we look at the hierarchy we can see that the UI here contains a ListView. That ListView contains ViewGroups (ConstraintLayout) that form the basis of each item that is displayed in the ListView. Each of these ViewGroups contains the following view types: an (AppCompat)ImageView (the acorn image), two TextViews, and another ImageView.
a View can be a smaller part of the UI you interact with, such as a button or text field, but a View can also be an invisible container that holds other Views and defines their layout properties.
When we’re automating UI tests, we try to locate these Views and check specific properties, or perform certain actions on the Views, such as clicking or entering text.
The third part of this series: IDs
Official Android documentation about Views: