Kea2-python 0.3.5__tar.gz → 1.0.0__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.

Files changed (49) hide show
  1. {kea2_python-0.3.5 → kea2_python-1.0.0}/Kea2_python.egg-info/PKG-INFO +64 -15
  2. {kea2_python-0.3.5 → kea2_python-1.0.0}/Kea2_python.egg-info/SOURCES.txt +4 -0
  3. {kea2_python-0.3.5 → kea2_python-1.0.0}/PKG-INFO +64 -15
  4. {kea2_python-0.3.5 → kea2_python-1.0.0}/README.md +63 -14
  5. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/__init__.py +1 -1
  6. kea2_python-1.0.0/kea2/assets/config_version.json +16 -0
  7. kea2_python-1.0.0/kea2/assets/fastbot_configs/teardown.py +18 -0
  8. kea2_python-1.0.0/kea2/assets/monkeyq.jar +0 -0
  9. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/quicktest.py +21 -2
  10. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/bug_report_generator.py +115 -35
  11. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/cli.py +19 -9
  12. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/fastbotManager.py +27 -7
  13. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/keaUtils.py +362 -110
  14. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/kea_launcher.py +65 -20
  15. kea2_python-1.0.0/kea2/mixin.py +22 -0
  16. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/report_merger.py +107 -42
  17. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/resultSyncer.py +1 -1
  18. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/templates/bug_report_template.html +139 -13
  19. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/templates/merged_bug_report_template.html +3293 -3213
  20. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/u2Driver.py +18 -8
  21. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/utils.py +60 -14
  22. kea2_python-1.0.0/kea2/version_manager.py +101 -0
  23. {kea2_python-0.3.5 → kea2_python-1.0.0}/pyproject.toml +1 -1
  24. kea2_python-0.3.5/kea2/assets/monkeyq.jar +0 -0
  25. {kea2_python-0.3.5 → kea2_python-1.0.0}/Kea2_python.egg-info/dependency_links.txt +0 -0
  26. {kea2_python-0.3.5 → kea2_python-1.0.0}/Kea2_python.egg-info/entry_points.txt +0 -0
  27. {kea2_python-0.3.5 → kea2_python-1.0.0}/Kea2_python.egg-info/requires.txt +0 -0
  28. {kea2_python-0.3.5 → kea2_python-1.0.0}/Kea2_python.egg-info/top_level.txt +0 -0
  29. {kea2_python-0.3.5 → kea2_python-1.0.0}/LICENSE +0 -0
  30. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/absDriver.py +0 -0
  31. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/adbUtils.py +0 -0
  32. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot-thirdpart.jar +0 -0
  33. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_configs/abl.strings +0 -0
  34. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_configs/awl.strings +0 -0
  35. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_configs/max.config +0 -0
  36. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_configs/max.fuzzing.strings +0 -0
  37. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_configs/max.schema.strings +0 -0
  38. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_configs/max.strings +0 -0
  39. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_configs/max.tree.pruning +0 -0
  40. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_configs/widget.block.py +0 -0
  41. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_libs/arm64-v8a/libfastbot_native.so +0 -0
  42. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_libs/armeabi-v7a/libfastbot_native.so +0 -0
  43. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_libs/x86/libfastbot_native.so +0 -0
  44. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/fastbot_libs/x86_64/libfastbot_native.so +0 -0
  45. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/framework.jar +0 -0
  46. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/assets/kea2-thirdpart.jar +0 -0
  47. {kea2_python-0.3.5 → kea2_python-1.0.0}/kea2/logWatcher.py +0 -0
  48. {kea2_python-0.3.5 → kea2_python-1.0.0}/setup.cfg +0 -0
  49. {kea2_python-0.3.5 → kea2_python-1.0.0}/tests/test_u2Selector.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Kea2-python
3
- Version: 0.3.5
3
+ Version: 1.0.0
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.8
@@ -64,11 +64,11 @@ Kea2 currently targets [Android](https://en.wikipedia.org/wiki/Android_(operatin
64
64
 
65
65
  **The ability of the three features in Kea2**
66
66
 
67
- | | **Feature 1** | **Feature 2** | **Feature 3** |
68
- | --- | --- | --- | ---- |
69
- | **Finding crashes** | :+1: | :+1: | :+1: |
70
- | **Finding crashes in deep states** | | :+1: | :+1: |
71
- | **Finding non-crashing functional (logic) bugs** | | | :+1: |
67
+ | | **Feature 1** | **Feature 2** | **Feature 3** |
68
+ | ------------------------------------------------ | ------------- | ------------- | ------------- |
69
+ | **Finding crashes** | :+1: | :+1: | :+1: |
70
+ | **Finding crashes in deep states** | | :+1: | :+1: |
71
+ | **Finding non-crashing functional (logic) bugs** | | | :+1: |
72
72
 
73
73
  ## Kea2's Users
74
74
 
@@ -78,6 +78,10 @@ Kea2 (and its idea) has been used/integrated by
78
78
 
79
79
  - [WeChat's iExplorer]() --- WeChat's in-house testing platform
80
80
 
81
+ - [WeChat Payment's UAT]() --- WeChat Payment's in-house testing platform
82
+
83
+ - [DevEco Testing](https://developer.huawei.com/consumer/cn/deveco-testing/) --- Huawei's Official Testing Platform for HarmonyOS
84
+
81
85
  - [ByteDance's Fastbot](https://github.com/bytedance/Fastbot_Android)
82
86
 
83
87
  Please let us know and willing to hear your feedback/questions if you are also using Kea2.
@@ -115,6 +119,15 @@ Upgrade Kea2 to its latest version if you already installed Kea2 before:
115
119
  ```bash
116
120
  python3 -m pip install -U kea2-python
117
121
  ```
122
+ > If you're using mirror sites like Tsinghua or USTC, you may fail to upgrade. Because these sites may not have the latest version yet. In this case, you can try to install Kea2 by specifying the latest version manually, or use `pypi.org` directly by `pip install kea2-python -i https://pypi.org/simple`.
123
+
124
+ Upgrade Kea2 to the specifc latest version (e.g., 0.3.6) if you already installed Kea2 before:
125
+ ```bash
126
+ python3 -m pip install -U kea2-python==0.3.6
127
+ ```
128
+
129
+
130
+
118
131
 
119
132
  ## Quick Test
120
133
 
@@ -145,9 +158,8 @@ Otherwise, please help [file a bug report](https://github.com/ecnusse/Kea2/issue
145
158
 
146
159
  Test your app with the full capability of Fastbot for stress testing and finding *stability problems* (i.e., *crashing bugs*);
147
160
 
148
-
149
161
  ```bash
150
- kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --running-minutes 10 --throttle 200
162
+ kea2 run -p it.feio.android.omninotes.alpha --running-minutes 10 --throttle 200
151
163
  ```
152
164
 
153
165
  To understand the meanings of the options, you can see our [manual](docs/manual_en.md#launching-kea2).
@@ -196,7 +208,7 @@ You can find the full example in script `quicktest.py`, and run this script with
196
208
 
197
209
  ```bash
198
210
  # Launch Kea2 and load one single script quicktest.py.
199
- kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -p quicktest.py
211
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d propertytest discover -p quicktest.py
200
212
  ```
201
213
 
202
214
  ## Feature 3(运行增强版Fastbot:加入自动断言)
@@ -220,7 +232,7 @@ In a social media app, message sending is a common feature. On the message sendi
220
232
  <div align="center">
221
233
  The expected behavior (the upper figure) and the buggy behavior (the lower figure).
222
234
  </div>
223
-
235
+
224
236
 
225
237
  For the preceding always-holding property, we can write the following script to validate the functional correctness: when there is an `input_box` widget on the message sending page, we can type any non-empty string text into the input box and assert `send_button` should always exists.
226
238
 
@@ -243,9 +255,37 @@ For the preceding always-holding property, we can write the following script to
243
255
 
244
256
  You can run this example by using the similar command line in Feature 2.
245
257
 
258
+ ## Feature 4 (Experimental feature, 实验中,脚本与遍历的混合测试)
259
+
260
+ > This feature is still under development. We are looking forward to your feedback! Contact us if you're interested in this feature.
261
+
262
+ Kea2 supports reusing existing Ui test Scripts. We are inspired by the idea that: *The existing Ui test scripts usually cover important app functionalities and can reach deep app states. Thus, they can be used as good "guiding scripts" to drive Fastbot to explore important and deep app states.*
263
+
264
+ For example, you may already have some existing Ui test scripts "login and add a friend", This feature allows you to use the existing script, set some breakpoints (i.e., interruptable points) in the script, and launch Fastbot to explore the app after every breakpoint. By using this feature, you can do the login first and then launch Fastbot to explore the app after login. Which helps Fastbot to explore deep app states. (fastbot can't do login by itself easily).
265
+
266
+ ### Example
267
+
268
+ See [guide_scripts.py](guide_scripts.py) for a full example.
269
+
270
+ By the decorator `@interruptable`, you can mark the testcase as "interruptable" so that Kea2 can recognize this script and launch fuzzing test after it returns.
271
+
272
+ Since the state of app is probably unpredicted after fuzzing tests, Kea2 provides a `common_teardown` function to clean up the environment between previous script and next script. The function can be manually specified in `configs/teardown.py`.
273
+
274
+ You can find the full example in `guide_scripts.py`, `property_omninotes.py` and `configs/teardown.py` . You can run one of the following commands:
275
+
276
+ ```bash
277
+ # Guide with guide_scripts.py and launch fuzzing test after every script.
278
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 500 --max-step 15 --driver-name d unittest discover -p guide_scripts.py
279
+
280
+ # Guide with guide_scripts.py and launch fuzzing test after every script(check properties during fuzzing).
281
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 500 --max-step 15 --driver-name d unittest discover -p guide_scripts.py propertytest discover -p quickstart2.py
282
+ ```
283
+
246
284
  ## Test Reports(测试报告)
247
285
 
248
- Kea2 automatically generates comprehensive HTML test reports after each testing session.
286
+ Kea2 automatically generates comprehensive HTML test reports after each testing session.(The location is in the output/ directory)
287
+
288
+ If automatic generation fails, you can also manually generate the test report using the command "kea2 report -p 'the path to the folder containing the test data'"
249
289
 
250
290
  The reports support both single test runs and merged analysis of multiple test sessions, making it easy to track testing progress and identify issues.
251
291
 
@@ -253,14 +293,19 @@ The reports support both single test runs and merged analysis of multiple test s
253
293
 
254
294
  ## Documentations(更多文档)
255
295
 
296
+
297
+ ### :blue_book: [User Manual](docs/manual_en.md) (Important!)
256
298
  You can find the [user manual](docs/manual_en.md), which includes:
257
299
  - Examples of using Kea2 on WeChat (in Chinese);
258
300
  - How to define Kea2's scripts and use the decorators (e.g., `@precondition`、`@prob`、`@max_tries`);
259
301
  - How to run Kea2 and Kea2's command line options
260
302
  - How to find and understand Kea2's testing results
261
303
  - How to [whitelist or blacklist](docs/blacklisting.md) specific activities, UI widgets and UI regions during fuzzing
304
+
305
+ ### Other resources about Kea2 (in Chinese)
262
306
  - [Q&A for Kea2 and PBT (对Kea2和PBT技术的常见问题和回答)](https://sy8pzmhmun.feishu.cn/wiki/SLGwwqgzIiEuC3kwmV8cSZY0nTg?from=from_copylink)
263
307
  - [Kea2 101 (Kea2 从0到1 的入门教程与最佳实践,建议新手阅读)](https://sy8pzmhmun.feishu.cn/wiki/EwaWwPCitiUJoBkIgALcHtglnDK?from=from_copylink)
308
+ - [Kea2 分享交流会 (2025.09, bilibili 录播)](https://www.bilibili.com/video/BV1CZYNz9Ei5/?vd_source=ab7968b8d764666d85d24af49d9b8891)
264
309
 
265
310
  Some blogs on Kea/Kea2 (in Chinese):
266
311
  - [别再苦哈哈写测试脚本了,生成它们吧!(一)](https://mp.weixin.qq.com/s/R2kLCkXpDjpa8wCX4Eidtg)
@@ -275,13 +320,13 @@ Some blogs on Kea/Kea2 (in Chinese):
275
320
  <summary>Kea2的性质是什么含义?Kea2意义和价值是什么?</summary>
276
321
 
277
322
  kea2 其实是一个工具,它是python+u2+fastbot的集合体。 它本身更像是一台装好了发动机和轮子的汽车底盘。
278
-
323
+
279
324
  性质是苏老师他们团队提出的一个概念, 转换到测试领域的实际工作中,性质对应的是最小单位的功能(原子级功能),性质的依赖条件很少或没有,它可以自身运行。一个典型的性质就是登录,它仅仅具有输入用户名,输入密码,提交。再举个例子,给视频点个赞,也就是简单的两三步。就是一个性质。
280
-
325
+
281
326
  性质与kea2结合的意义是在于解决过去使用appium过重的问题。用appium去测试一个性质通常要写很多行的代码,引导界面到达性质的位置。但使用kea2,就只需要编写性质,如何到其所在的位置是交给fastbot和它的学习算法来搞定的。
282
-
327
+
283
328
  kea2另个重大的价值是,它解决了上述思想所需要的技术支撑,比appium更轻量的UI编写方式,fastbot编写性质的能力不足,以及无法编写逻辑和断言。整体上是保留了fastbot以往的优秀品质,完善了其不足和短板。
284
-
329
+
285
330
  简而言之,需要做传统的编排型的功能测试,仍然使用appium,使用kea2也行,但你感觉不到它的价值。本身有需要做混沌测试,模糊测试,兼容性测试。那么强烈,强烈推荐kea2。kea2更偏探索性测试而非编排型。
286
331
  </details>
287
332
 
@@ -344,6 +389,10 @@ Kea2 has been actively developed and maintained by the people in [ecnusse](https
344
389
 
345
390
  Kea2 has also received many valuable insights, advices, feedbacks and lessons shared by several industrial people from Bytedance ([Zhao Zhang](https://github.com/zhangzhao4444), Yuhui Su from the Fastbot team), OPay (Tiesong Liu), WeChat (Haochuan Lu, Yuetang Deng), Huawei, Xiaomi and etc. Kudos!
346
391
 
392
+ ### Star History
393
+
394
+ [![Star History Chart](https://api.star-history.com/svg?repos=ecnusse/Kea2&type=Date)](https://www.star-history.com/#ecnusse/Kea2&Date)
395
+
347
396
  [^1]: 不少UI自动化测试工具提供了“自定义事件序列”能力(如[Fastbot](https://github.com/bytedance/Fastbot_Android/blob/main/handbook-cn.md#%E8%87%AA%E5%AE%9A%E4%B9%89%E4%BA%8B%E4%BB%B6%E5%BA%8F%E5%88%97) 和[AppCrawler](https://github.com/seveniruby/AppCrawler)),但在实际使用中存在不少问题,如自定义能力有限、使用不灵活等。此前不少Fastbot用户抱怨过其“自定义事件序列”在使用中的问题,如[#209](https://github.com/bytedance/Fastbot_Android/issues/209), [#225](https://github.com/bytedance/Fastbot_Android/issues/225), [#286](https://github.com/bytedance/Fastbot_Android/issues/286)等。
348
397
 
349
398
  [^2]: 在UI自动化测试过程中支持自动断言是一个很重要的能力,但几乎没有测试工具提供这样的能力。我们注意到[AppCrawler](https://ceshiren.com/t/topic/15801/5)的开发者曾经希望提供一种断言机制,得到了用户的热切响应,不少用户从21年就开始催更,但始终未能实现。
@@ -16,10 +16,13 @@ kea2/fastbotManager.py
16
16
  kea2/keaUtils.py
17
17
  kea2/kea_launcher.py
18
18
  kea2/logWatcher.py
19
+ kea2/mixin.py
19
20
  kea2/report_merger.py
20
21
  kea2/resultSyncer.py
21
22
  kea2/u2Driver.py
22
23
  kea2/utils.py
24
+ kea2/version_manager.py
25
+ kea2/assets/config_version.json
23
26
  kea2/assets/fastbot-thirdpart.jar
24
27
  kea2/assets/framework.jar
25
28
  kea2/assets/kea2-thirdpart.jar
@@ -32,6 +35,7 @@ kea2/assets/fastbot_configs/max.fuzzing.strings
32
35
  kea2/assets/fastbot_configs/max.schema.strings
33
36
  kea2/assets/fastbot_configs/max.strings
34
37
  kea2/assets/fastbot_configs/max.tree.pruning
38
+ kea2/assets/fastbot_configs/teardown.py
35
39
  kea2/assets/fastbot_configs/widget.block.py
36
40
  kea2/assets/fastbot_libs/arm64-v8a/libfastbot_native.so
37
41
  kea2/assets/fastbot_libs/armeabi-v7a/libfastbot_native.so
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Kea2-python
3
- Version: 0.3.5
3
+ Version: 1.0.0
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.8
@@ -64,11 +64,11 @@ Kea2 currently targets [Android](https://en.wikipedia.org/wiki/Android_(operatin
64
64
 
65
65
  **The ability of the three features in Kea2**
66
66
 
67
- | | **Feature 1** | **Feature 2** | **Feature 3** |
68
- | --- | --- | --- | ---- |
69
- | **Finding crashes** | :+1: | :+1: | :+1: |
70
- | **Finding crashes in deep states** | | :+1: | :+1: |
71
- | **Finding non-crashing functional (logic) bugs** | | | :+1: |
67
+ | | **Feature 1** | **Feature 2** | **Feature 3** |
68
+ | ------------------------------------------------ | ------------- | ------------- | ------------- |
69
+ | **Finding crashes** | :+1: | :+1: | :+1: |
70
+ | **Finding crashes in deep states** | | :+1: | :+1: |
71
+ | **Finding non-crashing functional (logic) bugs** | | | :+1: |
72
72
 
73
73
  ## Kea2's Users
74
74
 
@@ -78,6 +78,10 @@ Kea2 (and its idea) has been used/integrated by
78
78
 
79
79
  - [WeChat's iExplorer]() --- WeChat's in-house testing platform
80
80
 
81
+ - [WeChat Payment's UAT]() --- WeChat Payment's in-house testing platform
82
+
83
+ - [DevEco Testing](https://developer.huawei.com/consumer/cn/deveco-testing/) --- Huawei's Official Testing Platform for HarmonyOS
84
+
81
85
  - [ByteDance's Fastbot](https://github.com/bytedance/Fastbot_Android)
82
86
 
83
87
  Please let us know and willing to hear your feedback/questions if you are also using Kea2.
@@ -115,6 +119,15 @@ Upgrade Kea2 to its latest version if you already installed Kea2 before:
115
119
  ```bash
116
120
  python3 -m pip install -U kea2-python
117
121
  ```
122
+ > If you're using mirror sites like Tsinghua or USTC, you may fail to upgrade. Because these sites may not have the latest version yet. In this case, you can try to install Kea2 by specifying the latest version manually, or use `pypi.org` directly by `pip install kea2-python -i https://pypi.org/simple`.
123
+
124
+ Upgrade Kea2 to the specifc latest version (e.g., 0.3.6) if you already installed Kea2 before:
125
+ ```bash
126
+ python3 -m pip install -U kea2-python==0.3.6
127
+ ```
128
+
129
+
130
+
118
131
 
119
132
  ## Quick Test
120
133
 
@@ -145,9 +158,8 @@ Otherwise, please help [file a bug report](https://github.com/ecnusse/Kea2/issue
145
158
 
146
159
  Test your app with the full capability of Fastbot for stress testing and finding *stability problems* (i.e., *crashing bugs*);
147
160
 
148
-
149
161
  ```bash
150
- kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --running-minutes 10 --throttle 200
162
+ kea2 run -p it.feio.android.omninotes.alpha --running-minutes 10 --throttle 200
151
163
  ```
152
164
 
153
165
  To understand the meanings of the options, you can see our [manual](docs/manual_en.md#launching-kea2).
@@ -196,7 +208,7 @@ You can find the full example in script `quicktest.py`, and run this script with
196
208
 
197
209
  ```bash
198
210
  # Launch Kea2 and load one single script quicktest.py.
199
- kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -p quicktest.py
211
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d propertytest discover -p quicktest.py
200
212
  ```
201
213
 
202
214
  ## Feature 3(运行增强版Fastbot:加入自动断言)
@@ -220,7 +232,7 @@ In a social media app, message sending is a common feature. On the message sendi
220
232
  <div align="center">
221
233
  The expected behavior (the upper figure) and the buggy behavior (the lower figure).
222
234
  </div>
223
-
235
+
224
236
 
225
237
  For the preceding always-holding property, we can write the following script to validate the functional correctness: when there is an `input_box` widget on the message sending page, we can type any non-empty string text into the input box and assert `send_button` should always exists.
226
238
 
@@ -243,9 +255,37 @@ For the preceding always-holding property, we can write the following script to
243
255
 
244
256
  You can run this example by using the similar command line in Feature 2.
245
257
 
258
+ ## Feature 4 (Experimental feature, 实验中,脚本与遍历的混合测试)
259
+
260
+ > This feature is still under development. We are looking forward to your feedback! Contact us if you're interested in this feature.
261
+
262
+ Kea2 supports reusing existing Ui test Scripts. We are inspired by the idea that: *The existing Ui test scripts usually cover important app functionalities and can reach deep app states. Thus, they can be used as good "guiding scripts" to drive Fastbot to explore important and deep app states.*
263
+
264
+ For example, you may already have some existing Ui test scripts "login and add a friend", This feature allows you to use the existing script, set some breakpoints (i.e., interruptable points) in the script, and launch Fastbot to explore the app after every breakpoint. By using this feature, you can do the login first and then launch Fastbot to explore the app after login. Which helps Fastbot to explore deep app states. (fastbot can't do login by itself easily).
265
+
266
+ ### Example
267
+
268
+ See [guide_scripts.py](guide_scripts.py) for a full example.
269
+
270
+ By the decorator `@interruptable`, you can mark the testcase as "interruptable" so that Kea2 can recognize this script and launch fuzzing test after it returns.
271
+
272
+ Since the state of app is probably unpredicted after fuzzing tests, Kea2 provides a `common_teardown` function to clean up the environment between previous script and next script. The function can be manually specified in `configs/teardown.py`.
273
+
274
+ You can find the full example in `guide_scripts.py`, `property_omninotes.py` and `configs/teardown.py` . You can run one of the following commands:
275
+
276
+ ```bash
277
+ # Guide with guide_scripts.py and launch fuzzing test after every script.
278
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 500 --max-step 15 --driver-name d unittest discover -p guide_scripts.py
279
+
280
+ # Guide with guide_scripts.py and launch fuzzing test after every script(check properties during fuzzing).
281
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 500 --max-step 15 --driver-name d unittest discover -p guide_scripts.py propertytest discover -p quickstart2.py
282
+ ```
283
+
246
284
  ## Test Reports(测试报告)
247
285
 
248
- Kea2 automatically generates comprehensive HTML test reports after each testing session.
286
+ Kea2 automatically generates comprehensive HTML test reports after each testing session.(The location is in the output/ directory)
287
+
288
+ If automatic generation fails, you can also manually generate the test report using the command "kea2 report -p 'the path to the folder containing the test data'"
249
289
 
250
290
  The reports support both single test runs and merged analysis of multiple test sessions, making it easy to track testing progress and identify issues.
251
291
 
@@ -253,14 +293,19 @@ The reports support both single test runs and merged analysis of multiple test s
253
293
 
254
294
  ## Documentations(更多文档)
255
295
 
296
+
297
+ ### :blue_book: [User Manual](docs/manual_en.md) (Important!)
256
298
  You can find the [user manual](docs/manual_en.md), which includes:
257
299
  - Examples of using Kea2 on WeChat (in Chinese);
258
300
  - How to define Kea2's scripts and use the decorators (e.g., `@precondition`、`@prob`、`@max_tries`);
259
301
  - How to run Kea2 and Kea2's command line options
260
302
  - How to find and understand Kea2's testing results
261
303
  - How to [whitelist or blacklist](docs/blacklisting.md) specific activities, UI widgets and UI regions during fuzzing
304
+
305
+ ### Other resources about Kea2 (in Chinese)
262
306
  - [Q&A for Kea2 and PBT (对Kea2和PBT技术的常见问题和回答)](https://sy8pzmhmun.feishu.cn/wiki/SLGwwqgzIiEuC3kwmV8cSZY0nTg?from=from_copylink)
263
307
  - [Kea2 101 (Kea2 从0到1 的入门教程与最佳实践,建议新手阅读)](https://sy8pzmhmun.feishu.cn/wiki/EwaWwPCitiUJoBkIgALcHtglnDK?from=from_copylink)
308
+ - [Kea2 分享交流会 (2025.09, bilibili 录播)](https://www.bilibili.com/video/BV1CZYNz9Ei5/?vd_source=ab7968b8d764666d85d24af49d9b8891)
264
309
 
265
310
  Some blogs on Kea/Kea2 (in Chinese):
266
311
  - [别再苦哈哈写测试脚本了,生成它们吧!(一)](https://mp.weixin.qq.com/s/R2kLCkXpDjpa8wCX4Eidtg)
@@ -275,13 +320,13 @@ Some blogs on Kea/Kea2 (in Chinese):
275
320
  <summary>Kea2的性质是什么含义?Kea2意义和价值是什么?</summary>
276
321
 
277
322
  kea2 其实是一个工具,它是python+u2+fastbot的集合体。 它本身更像是一台装好了发动机和轮子的汽车底盘。
278
-
323
+
279
324
  性质是苏老师他们团队提出的一个概念, 转换到测试领域的实际工作中,性质对应的是最小单位的功能(原子级功能),性质的依赖条件很少或没有,它可以自身运行。一个典型的性质就是登录,它仅仅具有输入用户名,输入密码,提交。再举个例子,给视频点个赞,也就是简单的两三步。就是一个性质。
280
-
325
+
281
326
  性质与kea2结合的意义是在于解决过去使用appium过重的问题。用appium去测试一个性质通常要写很多行的代码,引导界面到达性质的位置。但使用kea2,就只需要编写性质,如何到其所在的位置是交给fastbot和它的学习算法来搞定的。
282
-
327
+
283
328
  kea2另个重大的价值是,它解决了上述思想所需要的技术支撑,比appium更轻量的UI编写方式,fastbot编写性质的能力不足,以及无法编写逻辑和断言。整体上是保留了fastbot以往的优秀品质,完善了其不足和短板。
284
-
329
+
285
330
  简而言之,需要做传统的编排型的功能测试,仍然使用appium,使用kea2也行,但你感觉不到它的价值。本身有需要做混沌测试,模糊测试,兼容性测试。那么强烈,强烈推荐kea2。kea2更偏探索性测试而非编排型。
286
331
  </details>
287
332
 
@@ -344,6 +389,10 @@ Kea2 has been actively developed and maintained by the people in [ecnusse](https
344
389
 
345
390
  Kea2 has also received many valuable insights, advices, feedbacks and lessons shared by several industrial people from Bytedance ([Zhao Zhang](https://github.com/zhangzhao4444), Yuhui Su from the Fastbot team), OPay (Tiesong Liu), WeChat (Haochuan Lu, Yuetang Deng), Huawei, Xiaomi and etc. Kudos!
346
391
 
392
+ ### Star History
393
+
394
+ [![Star History Chart](https://api.star-history.com/svg?repos=ecnusse/Kea2&type=Date)](https://www.star-history.com/#ecnusse/Kea2&Date)
395
+
347
396
  [^1]: 不少UI自动化测试工具提供了“自定义事件序列”能力(如[Fastbot](https://github.com/bytedance/Fastbot_Android/blob/main/handbook-cn.md#%E8%87%AA%E5%AE%9A%E4%B9%89%E4%BA%8B%E4%BB%B6%E5%BA%8F%E5%88%97) 和[AppCrawler](https://github.com/seveniruby/AppCrawler)),但在实际使用中存在不少问题,如自定义能力有限、使用不灵活等。此前不少Fastbot用户抱怨过其“自定义事件序列”在使用中的问题,如[#209](https://github.com/bytedance/Fastbot_Android/issues/209), [#225](https://github.com/bytedance/Fastbot_Android/issues/225), [#286](https://github.com/bytedance/Fastbot_Android/issues/286)等。
348
397
 
349
398
  [^2]: 在UI自动化测试过程中支持自动断言是一个很重要的能力,但几乎没有测试工具提供这样的能力。我们注意到[AppCrawler](https://ceshiren.com/t/topic/15801/5)的开发者曾经希望提供一种断言机制,得到了用户的热切响应,不少用户从21年就开始催更,但始终未能实现。
@@ -49,11 +49,11 @@ Kea2 currently targets [Android](https://en.wikipedia.org/wiki/Android_(operatin
49
49
 
50
50
  **The ability of the three features in Kea2**
51
51
 
52
- | | **Feature 1** | **Feature 2** | **Feature 3** |
53
- | --- | --- | --- | ---- |
54
- | **Finding crashes** | :+1: | :+1: | :+1: |
55
- | **Finding crashes in deep states** | | :+1: | :+1: |
56
- | **Finding non-crashing functional (logic) bugs** | | | :+1: |
52
+ | | **Feature 1** | **Feature 2** | **Feature 3** |
53
+ | ------------------------------------------------ | ------------- | ------------- | ------------- |
54
+ | **Finding crashes** | :+1: | :+1: | :+1: |
55
+ | **Finding crashes in deep states** | | :+1: | :+1: |
56
+ | **Finding non-crashing functional (logic) bugs** | | | :+1: |
57
57
 
58
58
  ## Kea2's Users
59
59
 
@@ -63,6 +63,10 @@ Kea2 (and its idea) has been used/integrated by
63
63
 
64
64
  - [WeChat's iExplorer]() --- WeChat's in-house testing platform
65
65
 
66
+ - [WeChat Payment's UAT]() --- WeChat Payment's in-house testing platform
67
+
68
+ - [DevEco Testing](https://developer.huawei.com/consumer/cn/deveco-testing/) --- Huawei's Official Testing Platform for HarmonyOS
69
+
66
70
  - [ByteDance's Fastbot](https://github.com/bytedance/Fastbot_Android)
67
71
 
68
72
  Please let us know and willing to hear your feedback/questions if you are also using Kea2.
@@ -100,6 +104,15 @@ Upgrade Kea2 to its latest version if you already installed Kea2 before:
100
104
  ```bash
101
105
  python3 -m pip install -U kea2-python
102
106
  ```
107
+ > If you're using mirror sites like Tsinghua or USTC, you may fail to upgrade. Because these sites may not have the latest version yet. In this case, you can try to install Kea2 by specifying the latest version manually, or use `pypi.org` directly by `pip install kea2-python -i https://pypi.org/simple`.
108
+
109
+ Upgrade Kea2 to the specifc latest version (e.g., 0.3.6) if you already installed Kea2 before:
110
+ ```bash
111
+ python3 -m pip install -U kea2-python==0.3.6
112
+ ```
113
+
114
+
115
+
103
116
 
104
117
  ## Quick Test
105
118
 
@@ -130,9 +143,8 @@ Otherwise, please help [file a bug report](https://github.com/ecnusse/Kea2/issue
130
143
 
131
144
  Test your app with the full capability of Fastbot for stress testing and finding *stability problems* (i.e., *crashing bugs*);
132
145
 
133
-
134
146
  ```bash
135
- kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --running-minutes 10 --throttle 200
147
+ kea2 run -p it.feio.android.omninotes.alpha --running-minutes 10 --throttle 200
136
148
  ```
137
149
 
138
150
  To understand the meanings of the options, you can see our [manual](docs/manual_en.md#launching-kea2).
@@ -181,7 +193,7 @@ You can find the full example in script `quicktest.py`, and run this script with
181
193
 
182
194
  ```bash
183
195
  # Launch Kea2 and load one single script quicktest.py.
184
- kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -p quicktest.py
196
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d propertytest discover -p quicktest.py
185
197
  ```
186
198
 
187
199
  ## Feature 3(运行增强版Fastbot:加入自动断言)
@@ -205,7 +217,7 @@ In a social media app, message sending is a common feature. On the message sendi
205
217
  <div align="center">
206
218
  The expected behavior (the upper figure) and the buggy behavior (the lower figure).
207
219
  </div>
208
-
220
+
209
221
 
210
222
  For the preceding always-holding property, we can write the following script to validate the functional correctness: when there is an `input_box` widget on the message sending page, we can type any non-empty string text into the input box and assert `send_button` should always exists.
211
223
 
@@ -228,9 +240,37 @@ For the preceding always-holding property, we can write the following script to
228
240
 
229
241
  You can run this example by using the similar command line in Feature 2.
230
242
 
243
+ ## Feature 4 (Experimental feature, 实验中,脚本与遍历的混合测试)
244
+
245
+ > This feature is still under development. We are looking forward to your feedback! Contact us if you're interested in this feature.
246
+
247
+ Kea2 supports reusing existing Ui test Scripts. We are inspired by the idea that: *The existing Ui test scripts usually cover important app functionalities and can reach deep app states. Thus, they can be used as good "guiding scripts" to drive Fastbot to explore important and deep app states.*
248
+
249
+ For example, you may already have some existing Ui test scripts "login and add a friend", This feature allows you to use the existing script, set some breakpoints (i.e., interruptable points) in the script, and launch Fastbot to explore the app after every breakpoint. By using this feature, you can do the login first and then launch Fastbot to explore the app after login. Which helps Fastbot to explore deep app states. (fastbot can't do login by itself easily).
250
+
251
+ ### Example
252
+
253
+ See [guide_scripts.py](guide_scripts.py) for a full example.
254
+
255
+ By the decorator `@interruptable`, you can mark the testcase as "interruptable" so that Kea2 can recognize this script and launch fuzzing test after it returns.
256
+
257
+ Since the state of app is probably unpredicted after fuzzing tests, Kea2 provides a `common_teardown` function to clean up the environment between previous script and next script. The function can be manually specified in `configs/teardown.py`.
258
+
259
+ You can find the full example in `guide_scripts.py`, `property_omninotes.py` and `configs/teardown.py` . You can run one of the following commands:
260
+
261
+ ```bash
262
+ # Guide with guide_scripts.py and launch fuzzing test after every script.
263
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 500 --max-step 15 --driver-name d unittest discover -p guide_scripts.py
264
+
265
+ # Guide with guide_scripts.py and launch fuzzing test after every script(check properties during fuzzing).
266
+ kea2 run -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 500 --max-step 15 --driver-name d unittest discover -p guide_scripts.py propertytest discover -p quickstart2.py
267
+ ```
268
+
231
269
  ## Test Reports(测试报告)
232
270
 
233
- Kea2 automatically generates comprehensive HTML test reports after each testing session.
271
+ Kea2 automatically generates comprehensive HTML test reports after each testing session.(The location is in the output/ directory)
272
+
273
+ If automatic generation fails, you can also manually generate the test report using the command "kea2 report -p 'the path to the folder containing the test data'"
234
274
 
235
275
  The reports support both single test runs and merged analysis of multiple test sessions, making it easy to track testing progress and identify issues.
236
276
 
@@ -238,14 +278,19 @@ The reports support both single test runs and merged analysis of multiple test s
238
278
 
239
279
  ## Documentations(更多文档)
240
280
 
281
+
282
+ ### :blue_book: [User Manual](docs/manual_en.md) (Important!)
241
283
  You can find the [user manual](docs/manual_en.md), which includes:
242
284
  - Examples of using Kea2 on WeChat (in Chinese);
243
285
  - How to define Kea2's scripts and use the decorators (e.g., `@precondition`、`@prob`、`@max_tries`);
244
286
  - How to run Kea2 and Kea2's command line options
245
287
  - How to find and understand Kea2's testing results
246
288
  - How to [whitelist or blacklist](docs/blacklisting.md) specific activities, UI widgets and UI regions during fuzzing
289
+
290
+ ### Other resources about Kea2 (in Chinese)
247
291
  - [Q&A for Kea2 and PBT (对Kea2和PBT技术的常见问题和回答)](https://sy8pzmhmun.feishu.cn/wiki/SLGwwqgzIiEuC3kwmV8cSZY0nTg?from=from_copylink)
248
292
  - [Kea2 101 (Kea2 从0到1 的入门教程与最佳实践,建议新手阅读)](https://sy8pzmhmun.feishu.cn/wiki/EwaWwPCitiUJoBkIgALcHtglnDK?from=from_copylink)
293
+ - [Kea2 分享交流会 (2025.09, bilibili 录播)](https://www.bilibili.com/video/BV1CZYNz9Ei5/?vd_source=ab7968b8d764666d85d24af49d9b8891)
249
294
 
250
295
  Some blogs on Kea/Kea2 (in Chinese):
251
296
  - [别再苦哈哈写测试脚本了,生成它们吧!(一)](https://mp.weixin.qq.com/s/R2kLCkXpDjpa8wCX4Eidtg)
@@ -260,13 +305,13 @@ Some blogs on Kea/Kea2 (in Chinese):
260
305
  <summary>Kea2的性质是什么含义?Kea2意义和价值是什么?</summary>
261
306
 
262
307
  kea2 其实是一个工具,它是python+u2+fastbot的集合体。 它本身更像是一台装好了发动机和轮子的汽车底盘。
263
-
308
+
264
309
  性质是苏老师他们团队提出的一个概念, 转换到测试领域的实际工作中,性质对应的是最小单位的功能(原子级功能),性质的依赖条件很少或没有,它可以自身运行。一个典型的性质就是登录,它仅仅具有输入用户名,输入密码,提交。再举个例子,给视频点个赞,也就是简单的两三步。就是一个性质。
265
-
310
+
266
311
  性质与kea2结合的意义是在于解决过去使用appium过重的问题。用appium去测试一个性质通常要写很多行的代码,引导界面到达性质的位置。但使用kea2,就只需要编写性质,如何到其所在的位置是交给fastbot和它的学习算法来搞定的。
267
-
312
+
268
313
  kea2另个重大的价值是,它解决了上述思想所需要的技术支撑,比appium更轻量的UI编写方式,fastbot编写性质的能力不足,以及无法编写逻辑和断言。整体上是保留了fastbot以往的优秀品质,完善了其不足和短板。
269
-
314
+
270
315
  简而言之,需要做传统的编排型的功能测试,仍然使用appium,使用kea2也行,但你感觉不到它的价值。本身有需要做混沌测试,模糊测试,兼容性测试。那么强烈,强烈推荐kea2。kea2更偏探索性测试而非编排型。
271
316
  </details>
272
317
 
@@ -329,6 +374,10 @@ Kea2 has been actively developed and maintained by the people in [ecnusse](https
329
374
 
330
375
  Kea2 has also received many valuable insights, advices, feedbacks and lessons shared by several industrial people from Bytedance ([Zhao Zhang](https://github.com/zhangzhao4444), Yuhui Su from the Fastbot team), OPay (Tiesong Liu), WeChat (Haochuan Lu, Yuetang Deng), Huawei, Xiaomi and etc. Kudos!
331
376
 
377
+ ### Star History
378
+
379
+ [![Star History Chart](https://api.star-history.com/svg?repos=ecnusse/Kea2&type=Date)](https://www.star-history.com/#ecnusse/Kea2&Date)
380
+
332
381
  [^1]: 不少UI自动化测试工具提供了“自定义事件序列”能力(如[Fastbot](https://github.com/bytedance/Fastbot_Android/blob/main/handbook-cn.md#%E8%87%AA%E5%AE%9A%E4%B9%89%E4%BA%8B%E4%BB%B6%E5%BA%8F%E5%88%97) 和[AppCrawler](https://github.com/seveniruby/AppCrawler)),但在实际使用中存在不少问题,如自定义能力有限、使用不灵活等。此前不少Fastbot用户抱怨过其“自定义事件序列”在使用中的问题,如[#209](https://github.com/bytedance/Fastbot_Android/issues/209), [#225](https://github.com/bytedance/Fastbot_Android/issues/225), [#286](https://github.com/bytedance/Fastbot_Android/issues/286)等。
333
382
 
334
383
  [^2]: 在UI自动化测试过程中支持自动断言是一个很重要的能力,但几乎没有测试工具提供这样的能力。我们注意到[AppCrawler](https://ceshiren.com/t/topic/15801/5)的开发者曾经希望提供一种断言机制,得到了用户的热切响应,不少用户从21年就开始催更,但始终未能实现。
@@ -1 +1 @@
1
- from .keaUtils import KeaTestRunner, precondition, prob, max_tries, Options
1
+ from .keaUtils import KeaTestRunner, precondition, prob, max_tries, Options, interruptable,HybridTestRunner,kea2_breakpoint
@@ -0,0 +1,16 @@
1
+ {
2
+ "compatibility infos": [
3
+ {
4
+ "name": "previous version",
5
+ "description": "The default initial version, <=0.3.6",
6
+ "from": "0.0.0",
7
+ "to": "0.3.6"
8
+ },
9
+ {
10
+ "name": "Hybrid test version 1.0.0",
11
+ "description": "Hybrid test was added in version 1.0.0. hybrid_test_config.py is required.",
12
+ "from": "1.0.0",
13
+ "to": ""
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,18 @@
1
+ from uiautomator2 import Device
2
+ import time
3
+
4
+
5
+ class HybridTestCase:
6
+ d: Device
7
+
8
+ PACKAGE_NAME = "it.feio.android.omninotes.alpha"
9
+ MAIN_ACTIVITY = "it.feio.android.omninotes.MainActivity"
10
+
11
+
12
+ def setUp(self: HybridTestCase):
13
+ self.d.app_start(PACKAGE_NAME, MAIN_ACTIVITY)
14
+ time.sleep(2)
15
+
16
+
17
+ def tearDown(self: HybridTestCase):
18
+ self.d.app_stop(PACKAGE_NAME)
@@ -9,9 +9,27 @@ from kea2.u2Driver import U2Driver
9
9
  class Omni_Notes_Sample(unittest.TestCase):
10
10
 
11
11
  def setUp(self):
12
- self.d = u2.connect()
12
+ self.d = u2.connect()
13
+
14
+ @prob(0.2)
15
+ @precondition(
16
+ lambda self: self.d(description="Navigate up").exists
17
+ )
18
+ def test_goBack(self):
19
+ print("Navigate back")
20
+ self.d(description="Navigate up").click()
21
+ sleep(0.5)
22
+
23
+ @prob(0.2)
24
+ @precondition(
25
+ lambda self: self.d(description="drawer closed").exists
26
+ )
27
+ def test_openDrawer(self):
28
+ print("Open drawer")
29
+ self.d(description="drawer closed").click()
30
+ sleep(0.5)
13
31
 
14
- @prob(0.7) # The probability of executing the function when precondition is satisfied.
32
+ @prob(0.5) # The probability of executing the function when precondition is satisfied.
15
33
  @precondition(
16
34
  lambda self: self.d(text="Omni Notes Alpha").exists
17
35
  and self.d(text="Settings").exists
@@ -45,6 +63,7 @@ class Omni_Notes_Sample(unittest.TestCase):
45
63
  assertion:
46
64
  The search input box is still being opened
47
65
  """
66
+ print("rotate the device")
48
67
  self.d.set_orientation("l")
49
68
  sleep(2)
50
69
  self.d.set_orientation("n")