Appium automated testing tutorial - self-learning network -Package and Activity

Package

Package package. Only in our app in this Package is unique, just like your ID number. When we do app automation, we need to know his Package, so we know the Package will know what we need to do to automate app. Note .apk package and different name.

Get app package name by uiautomatorviewer:

 

 

Activity

In Android, activity is the root of all programs, all programs are running processes in the activity, activity can be regarded as the most frequently encountered by the developer, which is also one of the most basic module android. In the android program, activity generally represents a screen phone screen. If the phone compared to a browser, then the activity is equivalent to a web page. In the activity of which can add some Button, Checkbox and other controls, you can see the concept and the concept of activity pages quite similar.

Usually a android application is composed of a plurality of activity, each jump may be performed between the plurality of activity. For example, a Button button is pressed, may jump to other activity, and the page jump is slightly different, it is possible to jump between the activity return value.

Tips: activity life cycle: that is, "to produce, run, destroy," but this one will call many methods onCreate (creation), onStart (activated), onResume (recovery), onPause (pause), onStop (stop), onDestroy ( destruction), onRestart (restart).

 

Activity Gets

aapt

aapt i.e. the Android Asset Packaging Tool, in the SDK build-tools directory. The tool can view, create, update ZIP file attachment formats (zip, jar, apk). Resource files can also be compiled into a binary file. Get command as follows:

aapt dump badging xxxx.apk

aapt dump badging xxxx.apk | find "launchable-activity"

可以把appt配置到环境变量(系统变量中的Path),这样运行便捷一些,appt路径:\Andriod_SDK\build-tools{version}

 

 

Activity页面布局元素

FrameLayout

FrameLayout是最简单的布局了。所有放在布局里的控件,都按照层次堆叠在屏幕的左上角。后加进来的控件覆盖前面的控件。

LinearLayout

LinearLayout按照垂直或者水平的顺序依次排列子元素,每一个子元素都位于前一个元素之后。如果是垂直排列,那么将是一个N行单列的结构,每一行只会有一个元素,而不论这个元素的宽度为多少;如果是水平排列,那么将是一个单行N列的结构。如果搭建两行两列的结构,通常的方式是先垂直排列两个元素,每一个元素里再包含一个LinearLayout进行水平排列。

 

 

 

 

RelativeLayout

RelativeLayout相对布局允许子元素指定它们相对于其父元素或兄弟元素的位置,这是实际布局中最常用的布局方式之一。

AbsoluteLayout

AbsoluteLayout是绝对位置布局。在此布局中的子元素的android:layout_x和android:layout_y属性将生效,用于描述该子元素的坐标位置。屏幕左上角为坐标原点(0,0),第一个0代表横坐标,向右移动此值增大,第二个0代表纵坐标,向下移动,此值增大。在此布局中的子元素可以相互重叠。在实际开发中,通常不采用此布局格式,

TableLayout

TableLayout 为表格布局,适用于N行N列的布局格式。一个TableLayout由许多TableRow组成,一个TableRow就代表TableLayout中的一行。

TextView

通常用于显示文字用的。

 

 

ImageView

通常用于显示图片用的。

 

 

 

Guess you like

Origin www.cnblogs.com/lp475177107/p/11953347.html