Kea2-python 0.0.1a1__tar.gz → 0.0.1a3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Kea2-python might be problematic. Click here for more details.
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/Kea2_python.egg-info/PKG-INFO +18 -58
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/PKG-INFO +18 -58
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/README.md +17 -57
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/absDriver.py +18 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/quickstart.py +11 -1
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/cli.py +0 -2
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/keaUtils.py +8 -1
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/u2Driver.py +15 -7
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/pyproject.toml +1 -1
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/Kea2_python.egg-info/SOURCES.txt +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/Kea2_python.egg-info/dependency_links.txt +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/Kea2_python.egg-info/entry_points.txt +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/Kea2_python.egg-info/requires.txt +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/Kea2_python.egg-info/top_level.txt +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/LICENSE +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/__init__.py +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/adbUtils.py +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot-thirdpart.jar +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/ADBKeyBoard.apk +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/abl.strings +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/awl.strings +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/max.config +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/max.fuzzing.strings +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/max.schema.strings +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/max.strings +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/max.tree.pruning +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_configs/widget.block.py +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_libs/arm64-v8a/libfastbot_native.so +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_libs/armeabi-v7a/libfastbot_native.so +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_libs/x86/libfastbot_native.so +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_libs/x86_64/libfastbot_native.so +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/framework.jar +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/monkeyq.jar +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/u2.jar +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/kea_launcher.py +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/logWatcher.py +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/utils.py +0 -0
- {kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Kea2-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.1a3
|
|
4
4
|
Summary: A python library for supporting and customizing automated UI testing for mobile apps
|
|
5
5
|
Author-email: Xixian Liang <xixian@stu.ecnu.edu.cn>
|
|
6
6
|
Requires-Python: >=3.9
|
|
@@ -27,7 +27,7 @@ These three features can be combined to customize and improve automated UI testi
|
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
|
-
> Kea2 is designed to be capable of fusing the (property-based) *
|
|
30
|
+
> Kea2 is designed to be capable of fusing the (property-based) *scripts* (e.g., written in uiautomator2) with automated UI testing tools (e.g., Fastbot), thus combining the strengths of human knowledge on app's business logics (empowered by the scripts) and random fuzzing. Many useful features (e.g., mimicing exploratory testing) can be implemented based on such a capability.
|
|
31
31
|
|
|
32
32
|
**The ability of the three features in Kea2**
|
|
33
33
|
| | **Feature 1** | **Feature 2** | **Feature 3** |
|
|
@@ -48,59 +48,20 @@ In the future, Kea2 will be extended to support
|
|
|
48
48
|
|
|
49
49
|
> Kea2 is inspired by many valuable insights, advices and lessons shared by experienced industrial practitioners from Bytedance (Zhao Zhang, Yuhui Su from the Fastbot team), OPay (Tiesong Liu), WeChat (Haochuan Lu), Huawei, Xiaomi and etc. Kudos!
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
# Deploy Kea2
|
|
53
|
-
|
|
54
51
|
## Installation
|
|
55
52
|
|
|
56
53
|
Running requirements/environment:
|
|
57
54
|
- support Windows, MacOS and Linux
|
|
58
|
-
- python 3.
|
|
55
|
+
- python 3.9+
|
|
59
56
|
- Android SDK installed
|
|
60
57
|
- **VPN closed** (Features 2 and 3 required)
|
|
61
58
|
|
|
62
|
-
1. Clone `Kea2` into your workspace.
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
git clone git@github.com:ecnusse/Kea2.git
|
|
66
|
-
cd Kea2
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2. Setup the python virtual environment with `uv`.
|
|
70
|
-
|
|
71
|
-
> [uv](https://github.com/astral-sh/uv) is a extremely fast python package and project manager. We use `uv` to create a python virtual environment for Kea2 to avoid any dependency issues or conflicts with your existing python environment.
|
|
72
|
-
`uv` is similar to `virtualenv` but much more powerful.
|
|
73
|
-
Of course, you can also setup Kea2 in your [global environment](https://github.com/ecnusse/Kea2/tree/dev?tab=readme-ov-file#appendix-install-kea2-in-a-global-environment).
|
|
74
|
-
|
|
75
59
|
```bash
|
|
76
|
-
pip install
|
|
77
|
-
pip install uv
|
|
78
|
-
uv sync
|
|
79
|
-
```
|
|
60
|
+
python3 -m pip install Kea2-python
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# For macOS users
|
|
84
|
-
brew install uv
|
|
85
|
-
uv sync
|
|
62
|
+
kea2 -h
|
|
86
63
|
```
|
|
87
64
|
|
|
88
|
-
3. Activate virtual environment
|
|
89
|
-
|
|
90
|
-
- Linux and macOS
|
|
91
|
-
```bash
|
|
92
|
-
source .venv/bin/activate
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
- Windows cmd
|
|
96
|
-
```cmd
|
|
97
|
-
\.venv\Scripts\activate.bat
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
- Windows powershell
|
|
101
|
-
```powershell
|
|
102
|
-
\.venv\Scripts\activate.ps1
|
|
103
|
-
```
|
|
104
65
|
|
|
105
66
|
## Quick Test
|
|
106
67
|
|
|
@@ -111,7 +72,8 @@ Kea2 connects to and runs on Android devices. We recommend you to do a quick tes
|
|
|
111
72
|
2. Run `quickstart.py` to test a sample app `omninotes` (released as `omninotes.apk` in Kea2's repository). The script `quickstart.py` will automatically install and test this sample app for a short time.
|
|
112
73
|
|
|
113
74
|
```python
|
|
114
|
-
|
|
75
|
+
kea2 init
|
|
76
|
+
python3 quickstart.py native
|
|
115
77
|
```
|
|
116
78
|
|
|
117
79
|
If you can see the app `omninotes` is successfully running and tested, Kea2 works. Otherwise, please help [file a bug report](https://github.com/ecnusse/Kea2/issues) with the error message to us. Thank you!
|
|
@@ -133,7 +95,7 @@ Test your app with the full capability of [Fastbot](https://github.com/bytedance
|
|
|
133
95
|
|
|
134
96
|
|
|
135
97
|
```bash
|
|
136
|
-
|
|
98
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --running-minutes 10 --throttle 200
|
|
137
99
|
```
|
|
138
100
|
|
|
139
101
|
The usage is similar to the the original [Fastbot](https://github.com/bytedance/Fastbot_Android?tab=readme-ov-file#run-fastbot-with-shell-command)'s shell commands.
|
|
@@ -185,19 +147,17 @@ In this case, the `Home` page is the entry page of the `Privacy` page and the `H
|
|
|
185
147
|
- In script's test method `test_goToPrivacy`, we specify the interaction logic (i.e., opening `Drawer`, clicking the option `Setting` and clicking `Privacy`) to guide Fastbot to reach the `Privacy` page.
|
|
186
148
|
- By the decorator `@prob`, we specify the probability (50% in this example) to do the guidance when we are at the `Home` page. As a result, Kea2 still allows Fastbot to explore other pages.
|
|
187
149
|
|
|
188
|
-
You can find the full example in script `
|
|
150
|
+
You can find the full example in script `quickstart.py` and run it by executing:
|
|
189
151
|
|
|
152
|
+
```python
|
|
153
|
+
python3 quickstart.py u2
|
|
154
|
+
```
|
|
190
155
|
|
|
191
156
|
```bash
|
|
192
|
-
# Launch Kea2 and load one single script
|
|
193
|
-
|
|
157
|
+
# Launch Kea2 and load one single script quickstart.py.
|
|
158
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest quickstart.py
|
|
194
159
|
```
|
|
195
160
|
|
|
196
|
-
or simply run:
|
|
197
|
-
|
|
198
|
-
```python
|
|
199
|
-
python3 quickstart2.py
|
|
200
|
-
```
|
|
201
161
|
|
|
202
162
|
|
|
203
163
|
|
|
@@ -294,21 +254,21 @@ We offer two ways to launch Kea2.
|
|
|
294
254
|
|
|
295
255
|
### 1. Launch by shell commands
|
|
296
256
|
|
|
297
|
-
Kea2 is compatible with `unittest` framework. You can manage your test cases in unittest style. You can launch Kea2 with `
|
|
257
|
+
Kea2 is compatible with `unittest` framework. You can manage your test cases in unittest style. You can launch Kea2 with `kea run` with driver options and sub-command `unittest` (for unittest options).
|
|
298
258
|
|
|
299
259
|
The shell command:
|
|
300
260
|
```
|
|
301
|
-
|
|
261
|
+
kea2 run <Kea2 cmds> unittest <unittest cmds>
|
|
302
262
|
```
|
|
303
263
|
|
|
304
264
|
Sample shell commands:
|
|
305
265
|
|
|
306
266
|
```bash
|
|
307
267
|
# Launch Kea2 and load one single script quickstart.py.
|
|
308
|
-
|
|
268
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest quickstart.py
|
|
309
269
|
|
|
310
270
|
# Launch Kea2 and load multiple scripts from the directory mytests/omni_notes
|
|
311
|
-
|
|
271
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -s mytests/omni_notes
|
|
312
272
|
```
|
|
313
273
|
|
|
314
274
|
| arg | meaning |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Kea2-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.1a3
|
|
4
4
|
Summary: A python library for supporting and customizing automated UI testing for mobile apps
|
|
5
5
|
Author-email: Xixian Liang <xixian@stu.ecnu.edu.cn>
|
|
6
6
|
Requires-Python: >=3.9
|
|
@@ -27,7 +27,7 @@ These three features can be combined to customize and improve automated UI testi
|
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
|
-
> Kea2 is designed to be capable of fusing the (property-based) *
|
|
30
|
+
> Kea2 is designed to be capable of fusing the (property-based) *scripts* (e.g., written in uiautomator2) with automated UI testing tools (e.g., Fastbot), thus combining the strengths of human knowledge on app's business logics (empowered by the scripts) and random fuzzing. Many useful features (e.g., mimicing exploratory testing) can be implemented based on such a capability.
|
|
31
31
|
|
|
32
32
|
**The ability of the three features in Kea2**
|
|
33
33
|
| | **Feature 1** | **Feature 2** | **Feature 3** |
|
|
@@ -48,59 +48,20 @@ In the future, Kea2 will be extended to support
|
|
|
48
48
|
|
|
49
49
|
> Kea2 is inspired by many valuable insights, advices and lessons shared by experienced industrial practitioners from Bytedance (Zhao Zhang, Yuhui Su from the Fastbot team), OPay (Tiesong Liu), WeChat (Haochuan Lu), Huawei, Xiaomi and etc. Kudos!
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
# Deploy Kea2
|
|
53
|
-
|
|
54
51
|
## Installation
|
|
55
52
|
|
|
56
53
|
Running requirements/environment:
|
|
57
54
|
- support Windows, MacOS and Linux
|
|
58
|
-
- python 3.
|
|
55
|
+
- python 3.9+
|
|
59
56
|
- Android SDK installed
|
|
60
57
|
- **VPN closed** (Features 2 and 3 required)
|
|
61
58
|
|
|
62
|
-
1. Clone `Kea2` into your workspace.
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
git clone git@github.com:ecnusse/Kea2.git
|
|
66
|
-
cd Kea2
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2. Setup the python virtual environment with `uv`.
|
|
70
|
-
|
|
71
|
-
> [uv](https://github.com/astral-sh/uv) is a extremely fast python package and project manager. We use `uv` to create a python virtual environment for Kea2 to avoid any dependency issues or conflicts with your existing python environment.
|
|
72
|
-
`uv` is similar to `virtualenv` but much more powerful.
|
|
73
|
-
Of course, you can also setup Kea2 in your [global environment](https://github.com/ecnusse/Kea2/tree/dev?tab=readme-ov-file#appendix-install-kea2-in-a-global-environment).
|
|
74
|
-
|
|
75
59
|
```bash
|
|
76
|
-
pip install
|
|
77
|
-
pip install uv
|
|
78
|
-
uv sync
|
|
79
|
-
```
|
|
60
|
+
python3 -m pip install Kea2-python
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# For macOS users
|
|
84
|
-
brew install uv
|
|
85
|
-
uv sync
|
|
62
|
+
kea2 -h
|
|
86
63
|
```
|
|
87
64
|
|
|
88
|
-
3. Activate virtual environment
|
|
89
|
-
|
|
90
|
-
- Linux and macOS
|
|
91
|
-
```bash
|
|
92
|
-
source .venv/bin/activate
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
- Windows cmd
|
|
96
|
-
```cmd
|
|
97
|
-
\.venv\Scripts\activate.bat
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
- Windows powershell
|
|
101
|
-
```powershell
|
|
102
|
-
\.venv\Scripts\activate.ps1
|
|
103
|
-
```
|
|
104
65
|
|
|
105
66
|
## Quick Test
|
|
106
67
|
|
|
@@ -111,7 +72,8 @@ Kea2 connects to and runs on Android devices. We recommend you to do a quick tes
|
|
|
111
72
|
2. Run `quickstart.py` to test a sample app `omninotes` (released as `omninotes.apk` in Kea2's repository). The script `quickstart.py` will automatically install and test this sample app for a short time.
|
|
112
73
|
|
|
113
74
|
```python
|
|
114
|
-
|
|
75
|
+
kea2 init
|
|
76
|
+
python3 quickstart.py native
|
|
115
77
|
```
|
|
116
78
|
|
|
117
79
|
If you can see the app `omninotes` is successfully running and tested, Kea2 works. Otherwise, please help [file a bug report](https://github.com/ecnusse/Kea2/issues) with the error message to us. Thank you!
|
|
@@ -133,7 +95,7 @@ Test your app with the full capability of [Fastbot](https://github.com/bytedance
|
|
|
133
95
|
|
|
134
96
|
|
|
135
97
|
```bash
|
|
136
|
-
|
|
98
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --running-minutes 10 --throttle 200
|
|
137
99
|
```
|
|
138
100
|
|
|
139
101
|
The usage is similar to the the original [Fastbot](https://github.com/bytedance/Fastbot_Android?tab=readme-ov-file#run-fastbot-with-shell-command)'s shell commands.
|
|
@@ -185,19 +147,17 @@ In this case, the `Home` page is the entry page of the `Privacy` page and the `H
|
|
|
185
147
|
- In script's test method `test_goToPrivacy`, we specify the interaction logic (i.e., opening `Drawer`, clicking the option `Setting` and clicking `Privacy`) to guide Fastbot to reach the `Privacy` page.
|
|
186
148
|
- By the decorator `@prob`, we specify the probability (50% in this example) to do the guidance when we are at the `Home` page. As a result, Kea2 still allows Fastbot to explore other pages.
|
|
187
149
|
|
|
188
|
-
You can find the full example in script `
|
|
150
|
+
You can find the full example in script `quickstart.py` and run it by executing:
|
|
189
151
|
|
|
152
|
+
```python
|
|
153
|
+
python3 quickstart.py u2
|
|
154
|
+
```
|
|
190
155
|
|
|
191
156
|
```bash
|
|
192
|
-
# Launch Kea2 and load one single script
|
|
193
|
-
|
|
157
|
+
# Launch Kea2 and load one single script quickstart.py.
|
|
158
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest quickstart.py
|
|
194
159
|
```
|
|
195
160
|
|
|
196
|
-
or simply run:
|
|
197
|
-
|
|
198
|
-
```python
|
|
199
|
-
python3 quickstart2.py
|
|
200
|
-
```
|
|
201
161
|
|
|
202
162
|
|
|
203
163
|
|
|
@@ -294,21 +254,21 @@ We offer two ways to launch Kea2.
|
|
|
294
254
|
|
|
295
255
|
### 1. Launch by shell commands
|
|
296
256
|
|
|
297
|
-
Kea2 is compatible with `unittest` framework. You can manage your test cases in unittest style. You can launch Kea2 with `
|
|
257
|
+
Kea2 is compatible with `unittest` framework. You can manage your test cases in unittest style. You can launch Kea2 with `kea run` with driver options and sub-command `unittest` (for unittest options).
|
|
298
258
|
|
|
299
259
|
The shell command:
|
|
300
260
|
```
|
|
301
|
-
|
|
261
|
+
kea2 run <Kea2 cmds> unittest <unittest cmds>
|
|
302
262
|
```
|
|
303
263
|
|
|
304
264
|
Sample shell commands:
|
|
305
265
|
|
|
306
266
|
```bash
|
|
307
267
|
# Launch Kea2 and load one single script quickstart.py.
|
|
308
|
-
|
|
268
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest quickstart.py
|
|
309
269
|
|
|
310
270
|
# Launch Kea2 and load multiple scripts from the directory mytests/omni_notes
|
|
311
|
-
|
|
271
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -s mytests/omni_notes
|
|
312
272
|
```
|
|
313
273
|
|
|
314
274
|
| arg | meaning |
|
|
@@ -15,7 +15,7 @@ These three features can be combined to customize and improve automated UI testi
|
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
-
> Kea2 is designed to be capable of fusing the (property-based) *
|
|
18
|
+
> Kea2 is designed to be capable of fusing the (property-based) *scripts* (e.g., written in uiautomator2) with automated UI testing tools (e.g., Fastbot), thus combining the strengths of human knowledge on app's business logics (empowered by the scripts) and random fuzzing. Many useful features (e.g., mimicing exploratory testing) can be implemented based on such a capability.
|
|
19
19
|
|
|
20
20
|
**The ability of the three features in Kea2**
|
|
21
21
|
| | **Feature 1** | **Feature 2** | **Feature 3** |
|
|
@@ -36,59 +36,20 @@ In the future, Kea2 will be extended to support
|
|
|
36
36
|
|
|
37
37
|
> Kea2 is inspired by many valuable insights, advices and lessons shared by experienced industrial practitioners from Bytedance (Zhao Zhang, Yuhui Su from the Fastbot team), OPay (Tiesong Liu), WeChat (Haochuan Lu), Huawei, Xiaomi and etc. Kudos!
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
# Deploy Kea2
|
|
41
|
-
|
|
42
39
|
## Installation
|
|
43
40
|
|
|
44
41
|
Running requirements/environment:
|
|
45
42
|
- support Windows, MacOS and Linux
|
|
46
|
-
- python 3.
|
|
43
|
+
- python 3.9+
|
|
47
44
|
- Android SDK installed
|
|
48
45
|
- **VPN closed** (Features 2 and 3 required)
|
|
49
46
|
|
|
50
|
-
1. Clone `Kea2` into your workspace.
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
git clone git@github.com:ecnusse/Kea2.git
|
|
54
|
-
cd Kea2
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
2. Setup the python virtual environment with `uv`.
|
|
58
|
-
|
|
59
|
-
> [uv](https://github.com/astral-sh/uv) is a extremely fast python package and project manager. We use `uv` to create a python virtual environment for Kea2 to avoid any dependency issues or conflicts with your existing python environment.
|
|
60
|
-
`uv` is similar to `virtualenv` but much more powerful.
|
|
61
|
-
Of course, you can also setup Kea2 in your [global environment](https://github.com/ecnusse/Kea2/tree/dev?tab=readme-ov-file#appendix-install-kea2-in-a-global-environment).
|
|
62
|
-
|
|
63
47
|
```bash
|
|
64
|
-
pip install
|
|
65
|
-
pip install uv
|
|
66
|
-
uv sync
|
|
67
|
-
```
|
|
48
|
+
python3 -m pip install Kea2-python
|
|
68
49
|
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# For macOS users
|
|
72
|
-
brew install uv
|
|
73
|
-
uv sync
|
|
50
|
+
kea2 -h
|
|
74
51
|
```
|
|
75
52
|
|
|
76
|
-
3. Activate virtual environment
|
|
77
|
-
|
|
78
|
-
- Linux and macOS
|
|
79
|
-
```bash
|
|
80
|
-
source .venv/bin/activate
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
- Windows cmd
|
|
84
|
-
```cmd
|
|
85
|
-
\.venv\Scripts\activate.bat
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
- Windows powershell
|
|
89
|
-
```powershell
|
|
90
|
-
\.venv\Scripts\activate.ps1
|
|
91
|
-
```
|
|
92
53
|
|
|
93
54
|
## Quick Test
|
|
94
55
|
|
|
@@ -99,7 +60,8 @@ Kea2 connects to and runs on Android devices. We recommend you to do a quick tes
|
|
|
99
60
|
2. Run `quickstart.py` to test a sample app `omninotes` (released as `omninotes.apk` in Kea2's repository). The script `quickstart.py` will automatically install and test this sample app for a short time.
|
|
100
61
|
|
|
101
62
|
```python
|
|
102
|
-
|
|
63
|
+
kea2 init
|
|
64
|
+
python3 quickstart.py native
|
|
103
65
|
```
|
|
104
66
|
|
|
105
67
|
If you can see the app `omninotes` is successfully running and tested, Kea2 works. Otherwise, please help [file a bug report](https://github.com/ecnusse/Kea2/issues) with the error message to us. Thank you!
|
|
@@ -121,7 +83,7 @@ Test your app with the full capability of [Fastbot](https://github.com/bytedance
|
|
|
121
83
|
|
|
122
84
|
|
|
123
85
|
```bash
|
|
124
|
-
|
|
86
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --running-minutes 10 --throttle 200
|
|
125
87
|
```
|
|
126
88
|
|
|
127
89
|
The usage is similar to the the original [Fastbot](https://github.com/bytedance/Fastbot_Android?tab=readme-ov-file#run-fastbot-with-shell-command)'s shell commands.
|
|
@@ -173,19 +135,17 @@ In this case, the `Home` page is the entry page of the `Privacy` page and the `H
|
|
|
173
135
|
- In script's test method `test_goToPrivacy`, we specify the interaction logic (i.e., opening `Drawer`, clicking the option `Setting` and clicking `Privacy`) to guide Fastbot to reach the `Privacy` page.
|
|
174
136
|
- By the decorator `@prob`, we specify the probability (50% in this example) to do the guidance when we are at the `Home` page. As a result, Kea2 still allows Fastbot to explore other pages.
|
|
175
137
|
|
|
176
|
-
You can find the full example in script `
|
|
138
|
+
You can find the full example in script `quickstart.py` and run it by executing:
|
|
177
139
|
|
|
140
|
+
```python
|
|
141
|
+
python3 quickstart.py u2
|
|
142
|
+
```
|
|
178
143
|
|
|
179
144
|
```bash
|
|
180
|
-
# Launch Kea2 and load one single script
|
|
181
|
-
|
|
145
|
+
# Launch Kea2 and load one single script quickstart.py.
|
|
146
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest quickstart.py
|
|
182
147
|
```
|
|
183
148
|
|
|
184
|
-
or simply run:
|
|
185
|
-
|
|
186
|
-
```python
|
|
187
|
-
python3 quickstart2.py
|
|
188
|
-
```
|
|
189
149
|
|
|
190
150
|
|
|
191
151
|
|
|
@@ -282,21 +242,21 @@ We offer two ways to launch Kea2.
|
|
|
282
242
|
|
|
283
243
|
### 1. Launch by shell commands
|
|
284
244
|
|
|
285
|
-
Kea2 is compatible with `unittest` framework. You can manage your test cases in unittest style. You can launch Kea2 with `
|
|
245
|
+
Kea2 is compatible with `unittest` framework. You can manage your test cases in unittest style. You can launch Kea2 with `kea run` with driver options and sub-command `unittest` (for unittest options).
|
|
286
246
|
|
|
287
247
|
The shell command:
|
|
288
248
|
```
|
|
289
|
-
|
|
249
|
+
kea2 run <Kea2 cmds> unittest <unittest cmds>
|
|
290
250
|
```
|
|
291
251
|
|
|
292
252
|
Sample shell commands:
|
|
293
253
|
|
|
294
254
|
```bash
|
|
295
255
|
# Launch Kea2 and load one single script quickstart.py.
|
|
296
|
-
|
|
256
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest quickstart.py
|
|
297
257
|
|
|
298
258
|
# Launch Kea2 and load multiple scripts from the directory mytests/omni_notes
|
|
299
|
-
|
|
259
|
+
kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -s mytests/omni_notes
|
|
300
260
|
```
|
|
301
261
|
|
|
302
262
|
| arg | meaning |
|
|
@@ -2,12 +2,24 @@ import abc
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class AbstractScriptDriver(abc.ABC):
|
|
5
|
+
_instances = {}
|
|
6
|
+
def __new__(cls, *args, **kwargs):
|
|
7
|
+
if cls not in cls._instances:
|
|
8
|
+
cls._instances[cls] = super().__new__(cls)
|
|
9
|
+
return cls._instances[cls]
|
|
10
|
+
|
|
5
11
|
@abc.abstractmethod
|
|
6
12
|
def getInstance(self):
|
|
7
13
|
pass
|
|
8
14
|
|
|
9
15
|
|
|
10
16
|
class AbstractStaticChecker(abc.ABC):
|
|
17
|
+
_instances = {}
|
|
18
|
+
def __new__(cls, *args, **kwargs):
|
|
19
|
+
if cls not in cls._instances:
|
|
20
|
+
cls._instances[cls] = super().__new__(cls)
|
|
21
|
+
return cls._instances[cls]
|
|
22
|
+
|
|
11
23
|
@abc.abstractmethod
|
|
12
24
|
def getInstance(self):
|
|
13
25
|
pass
|
|
@@ -18,6 +30,12 @@ class AbstractStaticChecker(abc.ABC):
|
|
|
18
30
|
|
|
19
31
|
|
|
20
32
|
class AbstractDriver(abc.ABC):
|
|
33
|
+
_instances = {}
|
|
34
|
+
def __new__(cls, *args, **kwargs):
|
|
35
|
+
if cls not in cls._instances:
|
|
36
|
+
cls._instances[cls] = super().__new__(cls)
|
|
37
|
+
return cls._instances[cls]
|
|
38
|
+
|
|
21
39
|
@classmethod
|
|
22
40
|
@abc.abstractmethod
|
|
23
41
|
def setDeviceSerial(self):
|
|
@@ -73,7 +73,17 @@ def check_installation():
|
|
|
73
73
|
d.stop_uiautomator()
|
|
74
74
|
|
|
75
75
|
|
|
76
|
+
def _get_agent():
|
|
77
|
+
import sys
|
|
78
|
+
if len(sys.argv) == 0 or sys.argv[1] == "u2":
|
|
79
|
+
sys.argv=sys.argv[:1]
|
|
80
|
+
return "u2"
|
|
81
|
+
sys.argv=sys.argv[:1]
|
|
82
|
+
return "native"
|
|
83
|
+
|
|
76
84
|
if __name__ == "__main__":
|
|
85
|
+
|
|
86
|
+
AGENT=_get_agent()
|
|
77
87
|
check_installation()
|
|
78
88
|
KeaTestRunner.setOptions(
|
|
79
89
|
Options(
|
|
@@ -84,7 +94,7 @@ if __name__ == "__main__":
|
|
|
84
94
|
maxStep=5000,
|
|
85
95
|
# running_mins=10, # specify the maximal running time in minutes, default value is 10m
|
|
86
96
|
# throttle=200, # specify the throttle in milliseconds, default value is 200ms
|
|
87
|
-
|
|
97
|
+
agent=AGENT # 'native' for running the vanilla Fastbot, 'u2' for running Kea2
|
|
88
98
|
)
|
|
89
99
|
)
|
|
90
100
|
unittest.main(testRunner=KeaTestRunner)
|
|
@@ -164,8 +164,6 @@ def main():
|
|
|
164
164
|
args = parser.parse_args()
|
|
165
165
|
|
|
166
166
|
import logging
|
|
167
|
-
logging.getLogger("urllib3").setLevel(logging.INFO)
|
|
168
|
-
logging.getLogger("uiautomator2").setLevel(logging.INFO)
|
|
169
167
|
if args.debug:
|
|
170
168
|
logging.basicConfig(level=logging.DEBUG)
|
|
171
169
|
logger.debug("args: %s", args)
|
|
@@ -3,6 +3,7 @@ import os
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
import subprocess
|
|
5
5
|
import threading
|
|
6
|
+
import traceback
|
|
6
7
|
from typing import IO, Callable, Any, Dict, List, Literal, NewType, Optional, Union
|
|
7
8
|
from unittest import TextTestRunner, registerResult, TestSuite, TestCase, TextTestResult
|
|
8
9
|
import random
|
|
@@ -442,7 +443,13 @@ class KeaTestRunner(TextTestRunner):
|
|
|
442
443
|
# Dependency injection. Static driver checker for precond
|
|
443
444
|
setattr(test, self.options.driverName, staticCheckerDriver)
|
|
444
445
|
# excecute the precond
|
|
445
|
-
|
|
446
|
+
try:
|
|
447
|
+
if not precond(test):
|
|
448
|
+
valid = False
|
|
449
|
+
break
|
|
450
|
+
except Exception as e:
|
|
451
|
+
print(f"[ERROR] Error when checking precond: {getFullPropName(test)}", flush=True)
|
|
452
|
+
traceback.print_exc()
|
|
446
453
|
valid = False
|
|
447
454
|
break
|
|
448
455
|
# if all the precond passed. make it the candidate prop.
|
|
@@ -12,6 +12,10 @@ from .utils import TimeStamp
|
|
|
12
12
|
|
|
13
13
|
TIME_STAMP = TimeStamp().getTimeStamp()
|
|
14
14
|
|
|
15
|
+
import logging
|
|
16
|
+
logging.getLogger("urllib3").setLevel(logging.INFO)
|
|
17
|
+
logging.getLogger("uiautomator2").setLevel(logging.INFO)
|
|
18
|
+
|
|
15
19
|
"""
|
|
16
20
|
The definition of U2ScriptDriver
|
|
17
21
|
"""
|
|
@@ -29,13 +33,11 @@ class U2ScriptDriver(AbstractScriptDriver):
|
|
|
29
33
|
"""
|
|
30
34
|
|
|
31
35
|
deviceSerial: str = None
|
|
32
|
-
|
|
36
|
+
d = None
|
|
37
|
+
|
|
33
38
|
@classmethod
|
|
34
39
|
def setDeviceSerial(cls, deviceSerial):
|
|
35
40
|
cls.deviceSerial = deviceSerial
|
|
36
|
-
|
|
37
|
-
def __init__(self):
|
|
38
|
-
self.d = None
|
|
39
41
|
|
|
40
42
|
def getInstance(self):
|
|
41
43
|
if self.d is None:
|
|
@@ -117,7 +119,7 @@ class StaticU2UiObject(u2.UiObject):
|
|
|
117
119
|
|
|
118
120
|
@property
|
|
119
121
|
def exists(self):
|
|
120
|
-
dict.update(self.selector, {"covered": "
|
|
122
|
+
dict.update(self.selector, {"covered": "false"})
|
|
121
123
|
xpath = self._getXPath(self.selector)
|
|
122
124
|
matched_widgets = self.session.xml.xpath(xpath)
|
|
123
125
|
return bool(matched_widgets)
|
|
@@ -205,9 +207,11 @@ class _HindenWidgetFilter:
|
|
|
205
207
|
)
|
|
206
208
|
self._nodes.append(e)
|
|
207
209
|
|
|
210
|
+
|
|
208
211
|
class U2StaticDevice(u2.Device):
|
|
209
|
-
def __init__(self):
|
|
212
|
+
def __init__(self, script_driver):
|
|
210
213
|
self.xml: etree._Element = None
|
|
214
|
+
self._script_driver = script_driver
|
|
211
215
|
|
|
212
216
|
def __call__(self, **kwargs):
|
|
213
217
|
return StaticU2UiObject(session=self, selector=u2.Selector(**kwargs))
|
|
@@ -222,6 +226,10 @@ class U2StaticDevice(u2.Device):
|
|
|
222
226
|
get_page_source, xpathEntry
|
|
223
227
|
)
|
|
224
228
|
return xpathEntry
|
|
229
|
+
|
|
230
|
+
def __getattr__(self, attr):
|
|
231
|
+
"""Proxy other methods to script_driver"""
|
|
232
|
+
return getattr(self._script_driver, attr)
|
|
225
233
|
|
|
226
234
|
class _XPathEntry(u2.xpath.XPathEntry):
|
|
227
235
|
def __init__(self, d):
|
|
@@ -246,7 +254,7 @@ class U2StaticChecker(AbstractStaticChecker):
|
|
|
246
254
|
```
|
|
247
255
|
"""
|
|
248
256
|
def __init__(self):
|
|
249
|
-
self.d = U2StaticDevice()
|
|
257
|
+
self.d = U2StaticDevice(U2ScriptDriver().getInstance())
|
|
250
258
|
|
|
251
259
|
def setHierarchy(self, hierarchy: str):
|
|
252
260
|
if hierarchy is None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_libs/arm64-v8a/libfastbot_native.so
RENAMED
|
File without changes
|
|
File without changes
|
{kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_libs/x86/libfastbot_native.so
RENAMED
|
File without changes
|
{kea2_python-0.0.1a1 → kea2_python-0.0.1a3}/kea2/assets/fastbot_libs/x86_64/libfastbot_native.so
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|