-
Notifications
You must be signed in to change notification settings - Fork 17
/
Android Studio, Appium online document;Note=Erxin.txt
210 lines (125 loc) · 3.93 KB
/
Android Studio, Appium online document;Note=Erxin.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
Android Studio, Appium online document;Note=Erxin
# Android Studio
## install
- reference
https://developer.android.com/studio/intro/migrate
- build project base on Gradle
- Eclipse/IntelliJ project can transfer to android studio
- Config on window
%APPDATA%\Google\<product><version>
C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudio4.1
+ set with environment variable
STUDIO_VM_OPTIONS point to .vmoptions
STUDIO_PROPERTIES point to .properties
STUDIO_JDK
.vmoptions is used to set the JVM options to imporve the performance of android studio
- default heap size is 1280MB, we can increase this for large projects
- import setting from Settings.jar
- customize IDE, idea.properties
- configure JDK version
File > Settings... > Build, Execution, Deployment > Build Tools > Gradle
Gradle SDK > select Embedded JDK
gradle proxy
```
# Project-wide Gradle settings.
...
systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=443
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.auth.ntlm.domain=domain
systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=443
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.auth.ntlm.domain=domain
```
- configure proxy
Appearance & Behavior > System Settings > HTTP Proxy
- shortcuts
https://developer.android.com/studio/intro/keyboard-shortcuts
- accessibility
https://developer.android.com/studio/intro/accessibility
- Tools > SDK Manager to update android sdk
## developer workflow
- basic
set up work environment
write code
build & run
iterate debug, profile, test
publish version sign
## Manage project
...
# Appium
- three kinds of apps
native
mobile web
hyber app
- concepts
自动化无需修改应用
不需要特定语言
不需要自动化接口上重造轮子
开源
- base on native automation tools
iOS 9.3+, XCUITest,
iOS 9.3-, UIAutomation
Android 4.3+, UiAutomator/UiAutomator2
Android 2.3+, Instrumentation
Windows, WinAppDriver
packaged into WebDriver API, JSON Wire Protocol, 自动化程序库
- terms, 概念
客户端、服务器架构, Appium是 REST API的 WEB 服务器
会话 session, session ID
预期能力, Desired capability
- 运行appium服务器
$ npm install -g appium
$ appium
- Appium客户端,支持对WebDriver协议扩展
- Appium Desktop, 提供inspector拉查看应用程序层级结构
## Get started
- installing
- install drivers for different platforms
Espresso driver android
+ java 8
+ window adndroid sdk
+ android sdk build tools version 24
UiAutomator2 driver android
XCUITest Driver for iOS
Mac Driver for Mac desktop
- verify installation by
$ npm install -g appium-docto
verify dependency
$ appium-doctor --ios|--android
- appium use same protocol as selenium, webdriver protocol
- list of client
https://appium.io/docs/en/about-appium/appium-clients/index.html
## set up UiAutomator2 driver for android
- reference
https://appium.io/docs/en/drivers/android-uiautomator2/#basic-setup
- requires
java 8
android sdk
android build tools 24
- usage
- capabilities
- commands
- basic set up
node & npm
JSD, installed
JAVA_HOME
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home"
- window setup
Set the ANDROID_HOME environment variable to match this path of android studio
- emulator setup
AVD Manager included with Android Studio or the SDK.
- init npm
$ npm init
$ npm install webdriverio
- add code
```
// javascript
const wdio = require("webdriverio");
```
- intel hardware accelerate emulator
https://github.com/intel/haxm
- for real device, ensure the developer mode is turned on