Kea2-python 1.1.0b1__py3-none-any.whl

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.
Files changed (49) hide show
  1. kea2/__init__.py +8 -0
  2. kea2/absDriver.py +56 -0
  3. kea2/adbUtils.py +554 -0
  4. kea2/assets/config_version.json +16 -0
  5. kea2/assets/fastbot-thirdpart.jar +0 -0
  6. kea2/assets/fastbot_configs/abl.strings +2 -0
  7. kea2/assets/fastbot_configs/awl.strings +3 -0
  8. kea2/assets/fastbot_configs/max.config +7 -0
  9. kea2/assets/fastbot_configs/max.fuzzing.strings +699 -0
  10. kea2/assets/fastbot_configs/max.schema.strings +1 -0
  11. kea2/assets/fastbot_configs/max.strings +3 -0
  12. kea2/assets/fastbot_configs/max.tree.pruning +27 -0
  13. kea2/assets/fastbot_configs/teardown.py +18 -0
  14. kea2/assets/fastbot_configs/widget.block.py +38 -0
  15. kea2/assets/fastbot_libs/arm64-v8a/libfastbot_native.so +0 -0
  16. kea2/assets/fastbot_libs/armeabi-v7a/libfastbot_native.so +0 -0
  17. kea2/assets/fastbot_libs/x86/libfastbot_native.so +0 -0
  18. kea2/assets/fastbot_libs/x86_64/libfastbot_native.so +0 -0
  19. kea2/assets/framework.jar +0 -0
  20. kea2/assets/kea2-thirdpart.jar +0 -0
  21. kea2/assets/monkeyq.jar +0 -0
  22. kea2/assets/quicktest.py +126 -0
  23. kea2/cli.py +216 -0
  24. kea2/fastbotManager.py +269 -0
  25. kea2/kea2_api.py +166 -0
  26. kea2/keaUtils.py +926 -0
  27. kea2/kea_launcher.py +299 -0
  28. kea2/logWatcher.py +92 -0
  29. kea2/mixin.py +0 -0
  30. kea2/report/__init__.py +0 -0
  31. kea2/report/bug_report_generator.py +879 -0
  32. kea2/report/mixin.py +496 -0
  33. kea2/report/report_merger.py +1066 -0
  34. kea2/report/templates/bug_report_template.html +4028 -0
  35. kea2/report/templates/merged_bug_report_template.html +3602 -0
  36. kea2/report/utils.py +10 -0
  37. kea2/result.py +257 -0
  38. kea2/resultSyncer.py +65 -0
  39. kea2/state.py +22 -0
  40. kea2/typedefs.py +32 -0
  41. kea2/u2Driver.py +612 -0
  42. kea2/utils.py +192 -0
  43. kea2/version_manager.py +102 -0
  44. kea2_python-1.1.0b1.dist-info/METADATA +447 -0
  45. kea2_python-1.1.0b1.dist-info/RECORD +49 -0
  46. kea2_python-1.1.0b1.dist-info/WHEEL +5 -0
  47. kea2_python-1.1.0b1.dist-info/entry_points.txt +2 -0
  48. kea2_python-1.1.0b1.dist-info/licenses/LICENSE +16 -0
  49. kea2_python-1.1.0b1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,447 @@
1
+ Metadata-Version: 2.4
2
+ Name: Kea2-python
3
+ Version: 1.1.0b1
4
+ Summary: A python library for supporting and customizing automated UI testing for mobile apps
5
+ Author-email: Xixian Liang <xixian@stu.ecnu.edu.cn>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: rtree>=1.3.0
10
+ Requires-Dist: jinja2>=3.0.0
11
+ Requires-Dist: uiautomator2>=3.3.3
12
+ Requires-Dist: adbutils>=2.9.3
13
+ Requires-Dist: packaging>=25.0
14
+ Dynamic: license-file
15
+
16
+
17
+
18
+ [![PyPI](https://img.shields.io/pypi/v/kea2-python.svg)](https://pypi.python.org/pypi/kea2-python)
19
+ [![PyPI Downloads](https://static.pepy.tech/badge/kea2-python)](https://pepy.tech/projects/kea2-python)
20
+ ![Python](https://img.shields.io/badge/python-3.8%2B-blue)
21
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/ecnusse/Kea2)
22
+
23
+ <div>
24
+ <img src="https://github.com/user-attachments/assets/8d9f8750-1e10-411b-a49f-7d8367bbe9fe" style="border-radius: 14px; width: 20%; height: 20%;"/>
25
+ </div>
26
+
27
+
28
+ Please contact Xixian Liang at [xixian@stu.ecnu.edu.cn](xixian@stu.ecnu.edu.cn) with your Wechat ID / QR code to be invited to the WeChat discussion group. Of course, we are also ready on GitHub to answer your questions/feedback.
29
+
30
+ #### Github repo [https://github.com/ecnusse/Kea2](https://github.com/ecnusse/Kea2)
31
+ #### Gitee mirror [https://gitee.com/XixianLiang/Kea2](https://gitee.com/XixianLiang/Kea2)
32
+
33
+
34
+
35
+
36
+ ### [点击此处:查看中文文档](README_cn.md)
37
+
38
+ ## About
39
+
40
+ <div align="center">
41
+ <img src="docs/images/kea2_logo.png" alt="kea_logo" style="border-radius: 14px; width: 20%; height: 20%;"/>
42
+ </div>
43
+ <div align="center">
44
+ <a href="https://en.wikipedia.org/wiki/Kea">Kea2's logo: A large parrot skilled in finding "bugs"</a>
45
+ </div>
46
+ </br>
47
+
48
+ Kea2 is an easy-to-use tool for fuzzing mobile apps. Its key *novelty* is able to fuse automated UI testing with scripts (usually written by human), thus empowering automated UI testing with human intelligence for effectively finding *crashing bugs* as well as *non-crashing functional (logic) bugs*.
49
+
50
+ Kea2 is currently built on top of [Fastbot](https://github.com/ecnusse/Fastbot_Android) 3.0 (a modified/enhanced version of the original [FastBot](https://github.com/bytedance/Fastbot_Android) 2.0), *an industrial-strength automated UI testing tool from ByteDance*, and [uiautomator2](https://github.com/openatx/uiautomator2), *an easy-to-use and stable Android automation library*.
51
+ Kea2 currently targets [Android](https://en.wikipedia.org/wiki/Android_(operating_system)) apps.
52
+
53
+ ## Novelty & Important features
54
+
55
+ <div align="center">
56
+ <div style="max-width:80%; max-height:80%">
57
+ <img src="docs/images/intro.png" style="border-radius: 14px; width: 80%; height: 80%;"/>
58
+ </div>
59
+ </div>
60
+
61
+ - **Feature 1**(查找稳定性问题): coming with the full capability of [Fastbot](https://github.com/bytedance/Fastbot_Android) for stress testing and finding *stability problems* (i.e., *crashing bugs*);
62
+
63
+ - **Feature 2**(自定义测试场景\事件序列\黑白名单\黑白控件[^1]): customizing testing scenarios when running Fastbot (e.g., testing specific app functionalities, executing specific event traces, entering specifc UI pages, reaching specific app states, blacklisting specific activities/UI widgets/UI regions) with the full capability and flexibility powered by *python* language and [uiautomator2](https://github.com/openatx/uiautomator2);
64
+
65
+ - **Feature 3**(支持断言机制[^2]): supporting auto-assertions when running Fastbot, based on the idea of [property-based testing](https://en.wikipedia.org/wiki/Software_testing#Property_testing) inheritted from [Kea](https://github.com/ecnusse/Kea), for finding *logic bugs* (i.e., *non-crashing functional bugs*).
66
+
67
+ For **Feature 2 and 3**, Kea2 allows you to focus on what app functionalities to be tested. You do not need to worry about how to reach these app functionalities. Just let Fastbot help. As a result, your scripts are usually short, robust and easy to maintain, and the corresponding app functionalities are much more stress-tested!
68
+
69
+ **The ability of the three features in Kea2**
70
+
71
+ | | **Feature 1** | **Feature 2** | **Feature 3** |
72
+ | ------------------------------------------------ | ------------- | ------------- | ------------- |
73
+ | **Finding crashes** | :+1: | :+1: | :+1: |
74
+ | **Finding crashes in deep states** | | :+1: | :+1: |
75
+ | **Finding non-crashing functional (logic) bugs** | | | :+1: |
76
+
77
+ ## Kea2's Users
78
+
79
+ Kea2 (and its idea) has been used/integrated by
80
+
81
+ - [OPay Business](https://play.google.com/store/apps/details?id=team.opay.pay.merchant.service) --- a financial & payment app (2 millions of active users daily). OPay uses Kea2 for regression testing on POS machines and mobile devices.
82
+
83
+ - [WeChat's iExplorer]() --- WeChat's in-house testing platform (coming with an interactive UI-based tool to ease writing scripts)
84
+
85
+ - [WeChat Payment's UAT]() --- WeChat Payment's in-house testing platform (fully automated property-based testing by synthesizing properties from the system specifications)
86
+
87
+ - [DevEco Testing](https://developer.huawei.com/consumer/cn/deveco-testing/) --- Huawei's Official Testing Platform for HarmonyOS (Kea2 is built upon Hypium)
88
+
89
+ - [ByteDance's Fastbot](https://github.com/bytedance/Fastbot_Android)
90
+
91
+ Please let us know and willing to hear your feedback/questions if you are also using Kea2.
92
+
93
+ ## Design & Roadmap
94
+ Kea2 currently works with:
95
+ - [unittest](https://docs.python.org/3/library/unittest.html) as the testing framework to manage the scripts;
96
+ - [uiautomator2](https://github.com/openatx/uiautomator2) as the UI test driver;
97
+ - [Fastbot](https://github.com/bytedance/Fastbot_Android) as the backend automated UI testing tool.
98
+
99
+ In the future, Kea2 will be extended to support
100
+ - [pytest](https://docs.pytest.org/en/stable/), another popular python testing framework;
101
+ - [Appium](https://github.com/appium/appium), [Hypium](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/hypium-python-guidelines) (for HarmonyOS/Open Harmony);
102
+ - any other automated UI testing tools (not limited to Fastbot)
103
+
104
+
105
+ ## Installation
106
+
107
+ Running environment:
108
+ - support Windows, MacOS and Linux
109
+ - python 3.8+, Android 5.0~16.0 (Android SDK installed)
110
+ - **VPN closed** (Features 2 and 3 required)
111
+
112
+ Install Kea2 by `pip`:
113
+ ```bash
114
+ python3 -m pip install kea2-python
115
+ ```
116
+
117
+ Find Kea2's options by running
118
+ ```bash
119
+ kea2 -h
120
+ ```
121
+
122
+ Upgrade Kea2 to its latest version if you already installed Kea2 before:
123
+ ```bash
124
+ python3 -m pip install -U kea2-python
125
+ ```
126
+ > 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`.
127
+
128
+ Upgrade Kea2 to the specifc latest version (e.g., 1.0.0) if you already installed Kea2 before:
129
+ ```bash
130
+ python3 -m pip install -U kea2-python==1.0.0
131
+ ```
132
+
133
+ Initialize Kea2 under your preferred working directory:
134
+ ```python
135
+ kea2 init
136
+ ```
137
+
138
+ > This initialization step is always needed if it is your first time to run Kea2. If you have upgraded Kea2, you are also recommended to rerun this step to ensure any potential new configurations of Kea2 would take effect.
139
+
140
+
141
+ ## Quick Test
142
+
143
+ Kea2 connects to and runs on Android devices. We recommend you to do a quick test to ensure that Kea2 is compatible with your devices.
144
+
145
+ 1. Connect to a real Android device or an Android emulator and make sure you can see the connected device by running `adb devices`.
146
+
147
+ 2. Run `quicktest.py` to test a sample app `omninotes` (released as `omninotes.apk` in Kea2's repository). The script `quicktest.py` will automatically install and test this sample app for a short time.
148
+
149
+ Run the quick test:
150
+ ```bash
151
+ python3 quicktest.py
152
+ ```
153
+
154
+ > This quick test would automatically download `omninotes.apk`. If the download fails, please copy `omninotes.apk` from Kea2's repository (top-level) to your working directory and execute the quick test command again.
155
+
156
+ If you can see the app `omninotes` is successfully running and tested, Kea2 works!
157
+ Otherwise, please help [file a bug report](https://github.com/ecnusse/Kea2/issues) with the error message to us. Thank you!
158
+
159
+
160
+
161
+ ## Feature 1(运行基础版Fastbot:查找稳定性错误)
162
+
163
+ Test your app with the full capability of Fastbot for stress testing and finding *stability problems* (i.e., *crashing bugs*);
164
+
165
+ ```bash
166
+ kea2 run -p it.feio.android.omninotes.alpha --running-minutes 10 --throttle 200
167
+ ```
168
+
169
+ To understand the meanings of the options, you can see our [user manual](docs/manual_en.md#launching-kea2).
170
+
171
+ > The usage is similar to the the original Fastbot's [shell commands](https://github.com/bytedance/Fastbot_Android?tab=readme-ov-file#run-fastbot-with-shell-command).
172
+
173
+ See more options by
174
+ ```bash
175
+ kea2 run -h
176
+ ```
177
+
178
+ ## Feature 2(运行增强版Fastbot:自定义测试场景\事件序列\黑白控件)
179
+
180
+ When running any automated UI testing tools like Fastbot to test your apps, you may find that some specifc UI pages or functionalities are difficult to reach or cover. The reason is that Fastbot lacks knowledge of your apps. Fortunately, this is the strength of script testing. In Feature 2, Kea2 can support writing small scripts to guide Fastbot to explore wherever we want. You can also use such small scripts to block specific widgets during UI testing.
181
+
182
+ In Kea2, a script is composed of two elements:
183
+ - **Precondition:** When to execute the script.
184
+ - **Interaction scenario:** The interaction logic (specified in the script's test method) to reach where we want.
185
+
186
+ ### Simple Example
187
+
188
+ Assuming `Privacy` is a hard-to-reach UI page during automated UI testing. Kea2 can easily guide Fastbot to reach this page.
189
+
190
+ ```python
191
+ @prob(0.5)
192
+ # precondition: when we are at the page `Home`
193
+ @precondition(lambda self:
194
+ self.d(text="Home").exists
195
+ )
196
+ def test_goToPrivacy(self):
197
+ """
198
+ Guide Fastbot to the page `Privacy` by opening `Drawer`,
199
+ clicking the option `Setting` and clicking `Privacy`.
200
+ """
201
+ self.d(description="Drawer").click()
202
+ self.d(text="Settings").click()
203
+ self.d(text="Privacy").click()
204
+ ```
205
+
206
+ - By the decorator `@precondition`, we specify the precondition --- when we are at the `Home` page.
207
+ In this case, the `Home` page is the entry page of the `Privacy` page and the `Home` page can be easily reached by Fastbot. Thus, the script will be activated when we are at `Home` page by checking whether a unique widget `Home` exists.
208
+ - 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.
209
+ - 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.
210
+
211
+ You can find the full example in script `quicktest.py`, and run this script with Fastbot by the command `kea2 run`:
212
+
213
+ ```bash
214
+ # Launch Kea2 and load one single script quicktest.py.
215
+ kea2 run -p it.feio.android.omninotes.alpha --running-minutes 10 --throttle 200 --driver-name d propertytest discover -p quicktest.py
216
+ ```
217
+
218
+ ## Feature 3(运行增强版Fastbot:加入自动断言)
219
+
220
+ Kea2 supports auto-assertions when running Fastbot for finding *logic bugs* (i.e., *non-crashing bugs*). To achieve this, you can add assertions in the scripts. When an assertion fails during automated UI testing, we find a likely functional bug.
221
+
222
+ In Feature 3, a script is composed of three elements:
223
+
224
+ - **Precondition:** When to execute the script.
225
+ - **Interaction scenario:** The interaction logic (specified in the script's test method).
226
+ - **Assertion:** The expected app behaviour.
227
+
228
+ ### Example
229
+
230
+ In a social media app, message sending is a common feature. On the message sending page, the `send` button should always appears when the input box is not empty (i.e., has some message).
231
+
232
+ <div align="center">
233
+ <img src="docs/images/socialAppBug.png" style="border-radius: 14px; width:30%; height:40%;"/>
234
+ </div>
235
+
236
+ <div align="center">
237
+ The expected behavior (the upper figure) and the buggy behavior (the lower figure).
238
+ </div>
239
+
240
+
241
+ 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.
242
+
243
+
244
+ ```python
245
+ @precondition(
246
+ lambda self: self.d(description="input_box").exists
247
+ )
248
+ def test_input_box(self):
249
+
250
+ # genenerate a random non-empty string (this is also property-based testing
251
+ # by feeding random text inputs!)
252
+ from hypothesis.strategies import text, ascii_letters
253
+ random_str = text(alphabet=ascii_letters).example()
254
+
255
+ # input this non-empty string into the input box
256
+ self.d(description="input_box").set_text(random_str)
257
+
258
+ # check whether the send button exists
259
+ assert self.d(description="send_button").exist
260
+
261
+ # we can even do more assertions, e.g.,
262
+ # the input string should successfully appear on the message sending page
263
+ assert self.d(text=random_str).exist
264
+ ```
265
+ > We use [hypothesis](https://github.com/HypothesisWorks/hypothesis) to generate random texts.
266
+
267
+ You can run this example by using the similar command line in Feature 2.
268
+
269
+ ## Feature 4(兼容已有脚本:通过前置脚本步骤到达特定层次)
270
+
271
+ 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.*
272
+
273
+ 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).
274
+
275
+ ### Example
276
+
277
+ Here are four example scripts in hybridetest_examples, each corresponding to different forms of user scripts, showing you how to launch kea2 in the existing code.
278
+
279
+ Specifically:
280
+
281
+ * [u2_unittest_example.py](hybridtest_examples\u2_unittest_example.py) is a u2 script organized with unittest.
282
+ * [u2_pytest_example.py](hybridtest_examples\u2_pytest_example.py) is a u2 script organized with pytest.
283
+ * [appium_unittest_example.py](hybridtest_examples\appium_unittest_example.py) is an appium script organized with unittest.
284
+ * [appium_pytest_example.py](hybridtest_examples\appium_pytest_example.py) is an appium script organized with pytest.
285
+
286
+ Some notes:
287
+
288
+ 1. You can control whether to execute the kea2-related code you have written by modifying the condition of 'if'. This allows you to easily enable or disable kea2 operations in the same script. Here we use environment variable as an example.
289
+ 2. Since kea2 is driven by u2, if an appium-written script wants to launch kea2, it is necessary to first close the appium session. Remember to configure the parameter `"noReset": True` in `desired_caps` to avoid resetting the application when closing the session.
290
+ 3. You need to insert the following code template into your existing test cases: Here, you can add your own hook logic in the commented sections, including starting or stopping the appium session, cleaning up instances, etc. This depends on how you want to design the setup and teardown. Apart from that, you only need to configure the `option` parameter and `configs_path` parameter(where your directory `configs` located, btw, `configs`'s location dependon where you executed `kea2 init`), then pass it to the `run_kea2_testing` function.
291
+
292
+ ```python
293
+ from kea2 import Kea2Tester, Options, U2Driver
294
+
295
+ if os.environ.get('KEA2_HYBRID_MODE', '').lower() == 'true':
296
+ '''
297
+ Note: The if condition here can be modified as needed according to the actual
298
+ situation of the project, the form of environment variables is just an example.
299
+ '''
300
+
301
+ # close your driver session etc. here
302
+ # ...
303
+
304
+ tester = Kea2Tester()
305
+ result = self.tester.run_kea2_testing(
306
+ Options(
307
+ driverName="d",
308
+ packageNames=[PACKAGE_NAME],
309
+ propertytest_args=["discover", "-p", "Omninotes_Sample.py"],
310
+ serial=DEVICE_SERIAL,
311
+ running_mins=2,
312
+ maxStep=20
313
+ ),
314
+ configs_path = None # Default, if your configs folder is located in the root directory, miss this.
315
+ )
316
+
317
+ # restart your driver session or clean instance here
318
+ # ...
319
+
320
+ return # this make your following steps of this testcase not work
321
+ ```
322
+
323
+
324
+
325
+ ## Test Reports(测试报告)
326
+
327
+ Kea2 automatically generates a HTML test report after each testing session. You can find the report in `output/` under your working directory.
328
+
329
+ You can also manually generate the test report by `kea2 report` (see `kea2 report -h` for details).
330
+
331
+ You can also merge the test report from multiple testing sessions by `kea2 merge` (see `kea2 merge -h` for details).
332
+ The merged test report is quite useful if you would test your apps for multiple sessions.
333
+
334
+ You can find a sample [test report](https://ecnusse.github.io/Kea2_sample_report/) from Opay (Thank you!). You can find more details on the test report in [this documentation](docs/test_report_introduction.md).
335
+
336
+ ## Documentations(更多文档)
337
+
338
+
339
+ ### :blue_book: [User Manual](docs/manual_en.md) (Important!)
340
+ You can find the [user manual](docs/manual_en.md), which includes:
341
+ - Examples of using Kea2 on WeChat (in Chinese);
342
+ - How to define Kea2's scripts and use the decorators (e.g., `@precondition`、`@prob`、`@max_tries`);
343
+ - How to run Kea2 and Kea2's command line options
344
+ - How to find and understand Kea2's testing results
345
+ - How to [whitelist or blacklist](docs/blacklisting.md) specific activities, UI widgets and UI regions during fuzzing
346
+
347
+ ### Other resources about Kea2 (in Chinese)
348
+ - [Q&A for Kea2 and PBT (对Kea2和PBT技术的常见问题和回答)](https://sy8pzmhmun.feishu.cn/wiki/SLGwwqgzIiEuC3kwmV8cSZY0nTg?from=from_copylink)
349
+ - [Kea2 101 (Kea2 从0到1 的入门教程与最佳实践,建议新手阅读)](https://sy8pzmhmun.feishu.cn/wiki/EwaWwPCitiUJoBkIgALcHtglnDK?from=from_copylink)
350
+ - [Kea2 分享交流会 (2025.09, bilibili 录播)](https://www.bilibili.com/video/BV1CZYNz9Ei5/)
351
+ - [Kea2 工具快速介绍 (2025.11, bilibili 录播)](https://www.bilibili.com/video/BV1WAyUBDEMw/)
352
+
353
+ Some blogs on Kea/Kea2 (in Chinese):
354
+ - [别再苦哈哈写测试脚本了,生成它们吧!(一)](https://mp.weixin.qq.com/s/R2kLCkXpDjpa8wCX4Eidtg)
355
+ - [别再苦哈哈写测试脚本了,生成它们吧!(二)](https://mp.weixin.qq.com/s/s4WkdstNcKupu9OP8jeOXw)
356
+ - [别再苦哈哈写测试脚本了,生成它们吧!(三)](https://mp.weixin.qq.com/s/BjXyo-xJRmPB_sCc4pmh8g)
357
+ - [2025 Let’s GoSSIP 软件安全暑期学校预告第一弹——Kea2](https://mp.weixin.qq.com/s/8_0_GNNin8E5BqTbJU33wg)
358
+ - [功能性质驱动的测试技术:下一代GUI自动化测试技术](https://appw8oh6ysg4044.xet.citv.cn/p/course/video/v_6882fa14e4b0694ca0ec0a1b) --- 视频回放&PPT@MTSC 2025
359
+
360
+ 工业界对Kea2的理解和评价(点击箭头查看详情):
361
+
362
+ <details>
363
+ <summary>Kea2的性质是什么含义?Kea2意义和价值是什么?</summary>
364
+
365
+ kea2 其实是一个工具,它是python+u2+fastbot的集合体。 它本身更像是一台装好了发动机和轮子的汽车底盘。
366
+
367
+ 性质是苏老师他们团队提出的一个概念, 转换到测试领域的实际工作中,性质对应的是最小单位的功能(原子级功能),性质的依赖条件很少或没有,它可以自身运行。一个典型的性质就是登录,它仅仅具有输入用户名,输入密码,提交。再举个例子,给视频点个赞,也就是简单的两三步。就是一个性质。
368
+
369
+ 性质与kea2结合的意义是在于解决过去使用appium过重的问题。用appium去测试一个性质通常要写很多行的代码,引导界面到达性质的位置。但使用kea2,就只需要编写性质,如何到其所在的位置是交给fastbot和它的学习算法来搞定的。
370
+
371
+ kea2另个重大的价值是,它解决了上述思想所需要的技术支撑,比appium更轻量的UI编写方式,fastbot编写性质的能力不足,以及无法编写逻辑和断言。整体上是保留了fastbot以往的优秀品质,完善了其不足和短板。
372
+
373
+ 简而言之,需要做传统的编排型的功能测试,仍然使用appium,使用kea2也行,但你感觉不到它的价值。本身有需要做混沌测试,模糊测试,兼容性测试。那么强烈,强烈推荐kea2。kea2更偏探索性测试而非编排型。
374
+ </details>
375
+
376
+ <details>
377
+ <summary>kea2组成是什么?kea2的核心作用?kea2做了什么?</summary>
378
+
379
+ kea2 组成:
380
+
381
+ fastbot -- fuzz测试引擎,负责跑路。
382
+ u2 -- 负责进行业务空间的操作。与使用selenium,appium,没什么区别。
383
+ python -- u2的操作,逻辑的编写,定制化的实现。
384
+
385
+ kea2的核心作用:
386
+
387
+ 提供了条件触发器。 在FB跑路的时候,会不停遍历条件触发器,一旦触发,挂起FB,开始执行触发器指定的 ui test 及 assert。执行完毕,继续切回FB跑路。
388
+
389
+ kea2做了什么:
390
+
391
+ 替换了FB的条件触发功能。
392
+ 替换了FB的黑名单,黑控件功能。
393
+ 替换了FB剪枝功能。
394
+ 增加了多元化的元素空间操作能力。
395
+ 增加了fuzz测试中的 逻辑设定。
396
+ 增加了断言能力。
397
+ 增加了元素操作能力。
398
+ </details>
399
+
400
+
401
+ ## Open-source projects used by Kea2
402
+
403
+ - [Fastbot](https://github.com/bytedance/Fastbot_Android)
404
+ - [uiautomator2](https://github.com/openatx/uiautomator2)
405
+ - [hypothesis](https://github.com/HypothesisWorks/hypothesis)
406
+
407
+ ## Relevant papers of Kea2
408
+
409
+ > General and Practical Property-based Testing for Android Apps. ASE 2024. [pdf](https://dl.acm.org/doi/10.1145/3691620.3694986)
410
+
411
+ > An Empirical Study of Functional Bugs in Android Apps. ISSTA 2023. [pdf](https://dl.acm.org/doi/10.1145/3597926.3598138)
412
+
413
+ > Fastbot2: Reusable Automated Model-based GUI Testing for Android Enhanced by Reinforcement Learning. ASE 2022. [pdf](https://dl.acm.org/doi/10.1145/3551349.3559505)
414
+
415
+ > Guided, Stochastic Model-Based GUI Testing of Android Apps. ESEC/FSE 2017. [pdf](https://dl.acm.org/doi/10.1145/3106237.3106298)
416
+
417
+ ## Maintainers/Contributors
418
+
419
+ Kea2 has been actively developed and maintained by the people in [ecnusse](https://github.com/ecnusse):
420
+
421
+ - [Xixian Liang](https://xixianliang.github.io/resume/) ([@XixianLiang][])
422
+ - [Bo Ma](https://github.com/majuzi123) ([@majuzi123][])
423
+ - [Cheng Peng](https://github.com/Drifterpc) ([@Drifterpc][])
424
+ - [Ting Su](https://tingsu.github.io/) ([@tingsu][])
425
+
426
+ [@XixianLiang]: https://github.com/XixianLiang
427
+ [@majuzi123]: https://github.com/majuzi123
428
+ [@Drifterpc]: https://github.com/Drifterpc
429
+ [@tingsu]: https://github.com/tingsu
430
+
431
+ [Zhendong Su](https://people.inf.ethz.ch/suz/), [Yiheng Xiong](https://xyiheng.github.io/), [Xiangchen Shen](https://xiangchenshen.github.io/), [Mengqian Xu](https://mengqianx.github.io/), [Haiying Sun](https://faculty.ecnu.edu.cn/_s43/shy/main.psp), [Jingling Sun](https://jinglingsun.github.io/), [Jue Wang](https://cv.juewang.info/), [Geguang Pu]() have also been actively participated in this project and contributed a lot!
432
+
433
+ 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!
434
+
435
+ ### Become a Contributor!
436
+
437
+ Kea2 is an open-source project and we are calling for more contributors to join us!
438
+
439
+ See [Developer guide](DEVELOP.md) for more details.
440
+
441
+ ## Star History
442
+
443
+ [![Star History Chart](https://api.star-history.com/svg?repos=ecnusse/Kea2&type=Date)](https://www.star-history.com/#ecnusse/Kea2&Date)
444
+
445
+ [^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)等。
446
+
447
+ [^2]: 在UI自动化测试过程中支持自动断言是一个很重要的能力,但几乎没有测试工具提供这样的能力。我们注意到[AppCrawler](https://ceshiren.com/t/topic/15801/5)的开发者曾经希望提供一种断言机制,得到了用户的热切响应,不少用户从21年就开始催更,但始终未能实现。
@@ -0,0 +1,49 @@
1
+ kea2/__init__.py,sha256=31JQuidfvcTzczGSWgFI6E3LH1Qfyzl7JiHY6IDO9_M,328
2
+ kea2/absDriver.py,sha256=NzmsLs1Ojz-yEXctGAqj7aKBwAQW19zd83l65RABCe8,1288
3
+ kea2/adbUtils.py,sha256=pSmVlXEu3edfGL56Ag2mLCX9yIMHephnsUXzXUUEwNU,19904
4
+ kea2/cli.py,sha256=kevMd2afcmvNEzQ8s8r84-gh01ic7jjalcGVAlch6SA,6206
5
+ kea2/fastbotManager.py,sha256=glhNFmneqwjliRQ2wVmsXehJyQjbm5M-AdnnJLw8ooo,9322
6
+ kea2/kea2_api.py,sha256=MIpuR_HjVUhElhR9uNMCabTFc5VC463WXtZS9dKR_1c,6349
7
+ kea2/keaUtils.py,sha256=01JORYphw3icwsfWYRtWzxzbLhdyon9U_uoZXheG8uo,37875
8
+ kea2/kea_launcher.py,sha256=Irsz_LNyRAPyv1nNdwepcLkUOnsaCKqtHY3oUD55ISA,10075
9
+ kea2/logWatcher.py,sha256=KfdDIZjeQzv5CV-o5TlWU7WBTOOCzshElYTPk6BnJ0Y,2599
10
+ kea2/mixin.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ kea2/result.py,sha256=fiwlP70Q51boj6vedv4kh9bVOk5VZEhENgvKuOe5wBU,9831
12
+ kea2/resultSyncer.py,sha256=HU1-_z4LRcF89XqLvnhngTsOH0R_ZdhuiVnIjsBIo3A,2360
13
+ kea2/state.py,sha256=dFMTPR128Syhh6P8n5tvCFrTmprpG5gt95oYl_ZA3yY,465
14
+ kea2/typedefs.py,sha256=XOA50SQLGiYr99HhSC5IYcKbVhWeDZJ-2J26dHKohk0,810
15
+ kea2/u2Driver.py,sha256=S-UnjvQSu7L7sLZSXaLo-i-6zOLMNIMv_Yj84X4UC6g,21290
16
+ kea2/utils.py,sha256=LACmNUkoMHVaoDHVevB_N41EbFkRd_ttE4J8HJ9aETg,5435
17
+ kea2/version_manager.py,sha256=LGSD3OqgrI4LAwLDSa2G4WRVcDppY92s1SjlCMqsQ6c,3196
18
+ kea2/assets/config_version.json,sha256=dYZRNo17hQq2SV45xxRCwDmykhsWWYI__w7vZXMHvXc,377
19
+ kea2/assets/fastbot-thirdpart.jar,sha256=0SZ_OoZFWDGMnazgXKceHgKvXdUDoIa3Gb2bcifaikk,85664
20
+ kea2/assets/framework.jar,sha256=rTluOJJKj2DFwh7ascXso1udYdWv00BxBwSQ3Vmv-fw,1149240
21
+ kea2/assets/kea2-thirdpart.jar,sha256=HYdtG2gqDLuLb72dpK3lX-Y6QUNTrJ-bfQopU5aWpfo,359346
22
+ kea2/assets/monkeyq.jar,sha256=jbQTaMy5AYgr5ovkRkCKJYJrfXpdma1g4HoESZDWSSo,115147
23
+ kea2/assets/quicktest.py,sha256=9IirE51ckT_D_v1OZqU-PNMIDB3sNlndKmzO01r83hA,4155
24
+ kea2/assets/fastbot_configs/abl.strings,sha256=Rn8_YEbVGOJqndIY_-kWnR5NaoFI-cuB-ij10Ddhl90,75
25
+ kea2/assets/fastbot_configs/awl.strings,sha256=-j4980GoWQxGOM9ijAwXPQmziCwFBZJFmuiv2tOEaYI,101
26
+ kea2/assets/fastbot_configs/max.config,sha256=rBgR4mdgBzqVPQ2lZaXqx2WN6tDzhe-FNizm4Y7tyA8,226
27
+ kea2/assets/fastbot_configs/max.fuzzing.strings,sha256=_3bNHwgzlISgxB7RmMury5X3qIo2jhVhEn8jow8jfbk,27554
28
+ kea2/assets/fastbot_configs/max.schema.strings,sha256=zYupzvmTtnbPYomI2UCPk0s6PE97t94myZU_j3HutRM,40
29
+ kea2/assets/fastbot_configs/max.strings,sha256=k82GAAZZG7KbDI7bk7DUklp41WJJO7j-j8Ss1BcybUw,32
30
+ kea2/assets/fastbot_configs/max.tree.pruning,sha256=dm0oesN75FFbVSkV7STDUmrNMpQUBEuO7Uymt6nEkBc,629
31
+ kea2/assets/fastbot_configs/teardown.py,sha256=dW6xHzozh2vXTB1qfCxAlT0xcv5kFwzX7kW1FmLfNA0,363
32
+ kea2/assets/fastbot_configs/widget.block.py,sha256=r9Njm2xSBls3GMDIHTPMdmlFRiOjJWuVsq2KiieWFXA,1272
33
+ kea2/assets/fastbot_libs/arm64-v8a/libfastbot_native.so,sha256=gh19xaSrZsEzDZrNriM9fQ2WO8infYHoNgVt4cVelnM,2011128
34
+ kea2/assets/fastbot_libs/armeabi-v7a/libfastbot_native.so,sha256=Z96EQOvoihtiLhWO1ca_EZ0vyeBPSMFLHYAgvjWTl-8,1338676
35
+ kea2/assets/fastbot_libs/x86/libfastbot_native.so,sha256=wC9wGxx6JozPaEoxRXZI4aMQ-HZ2mvM63Loyog3V9Qs,2042160
36
+ kea2/assets/fastbot_libs/x86_64/libfastbot_native.so,sha256=D2BBzBt5Tk-RwX38YL45OiGKKf2cZVFw_Vbr6WWJn68,2126440
37
+ kea2/report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ kea2/report/bug_report_generator.py,sha256=DYCTnx0cL-Ho4XbqTZItHQ2ktTI-s9bIO1KClihRgzw,35763
39
+ kea2/report/mixin.py,sha256=uy4aVnwNqF-hvnfmtoSnEXcW2uQEJzInHt1Ina2fy6w,19441
40
+ kea2/report/report_merger.py,sha256=fjSucrLZ8f6qOOKwjMtsB6LG2vaM2wGNnR-DTWnr3eA,40561
41
+ kea2/report/utils.py,sha256=r-oPtqbSDo8X0-V7zoIrz49TJ2-w-W444DS0de67mtk,344
42
+ kea2/report/templates/bug_report_template.html,sha256=A3Q4DWLctyoGISyvT_6Re7tGxDrULrrqrNfWRKXR7Gc,175534
43
+ kea2/report/templates/merged_bug_report_template.html,sha256=ZIZMXlE4slT_UScq324fXL4ZNMoSH0Autro-UU63g30,162826
44
+ kea2_python-1.1.0b1.dist-info/licenses/LICENSE,sha256=nM9PPjcsXVo5SzNsjRqWgA-gdJlwqZZcRDSC6Qf6bVE,2034
45
+ kea2_python-1.1.0b1.dist-info/METADATA,sha256=noLBfN9AeoG4oepacQzrLdqQi-7kxOH_YcPFOojkSaQ,25669
46
+ kea2_python-1.1.0b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
+ kea2_python-1.1.0b1.dist-info/entry_points.txt,sha256=mFX06TyxXiUAJQ6JZn8QHzfn8n5R8_KJ5W-pTm_fRCA,39
48
+ kea2_python-1.1.0b1.dist-info/top_level.txt,sha256=TsgNH4PQoNOVhegpO7AcjutMVWp6Z4KDL1pBH9FnMmk,5
49
+ kea2_python-1.1.0b1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ kea2 = kea2.cli:main
@@ -0,0 +1,16 @@
1
+ Kea2 Revised License
2
+
3
+ Effective from May 1st, 2025, The Kea2 SDK is hereby licensed as follows:
4
+  
5
+ Copyright (c) 2024-2025 ECNU Smart Software Lab. (The “Licensor”)
6
+ The Licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below (“Rights and Limitations”):
7
+
8
+ You may not provide or distribute the software to third parties. You may use it solely for your own internal use. “Internal use” permits distribution to your affiliates and to contractors where those contractors are permitted to exercise the Rights and Limitations solely on your and your affiliates’
9
+ behalf. An “affiliate” is an entity that controls, is controlled by, or is under common control with you. For the purposes of this definition "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty
10
+ percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
11
+  
12
+ You may not alter, remove, or obscure any licensing, copyright, or other notices of the Licensor in the software. Any use of the Licensor's trademarks is prohibited unless otherwise permitted by applicable law.
13
+  
14
+ This License will terminate immediately without notice should you breach any term.
15
+  
16
+ TO THE EXTENT THAT SUCH EXCLUSION IS PERMITTED BY LAW, (1)THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF SATISFACTORY QUALITY, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT, AND (2) IN NO EVENT SHALL THE LICENSOR, AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ kea2