Kea2-python 0.0.1a2__tar.gz → 0.0.1a4__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 (38) hide show
  1. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/Kea2_python.egg-info/PKG-INFO +10 -11
  2. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/Kea2_python.egg-info/requires.txt +1 -1
  3. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/PKG-INFO +10 -11
  4. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/README.md +7 -8
  5. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/absDriver.py +18 -0
  6. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/quickstart.py +2 -0
  7. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/cli.py +2 -4
  8. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/keaUtils.py +19 -1
  9. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/kea_launcher.py +14 -2
  10. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/u2Driver.py +15 -7
  11. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/pyproject.toml +3 -3
  12. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/Kea2_python.egg-info/SOURCES.txt +0 -0
  13. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/Kea2_python.egg-info/dependency_links.txt +0 -0
  14. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/Kea2_python.egg-info/entry_points.txt +0 -0
  15. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/Kea2_python.egg-info/top_level.txt +0 -0
  16. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/LICENSE +0 -0
  17. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/__init__.py +0 -0
  18. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/adbUtils.py +0 -0
  19. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot-thirdpart.jar +0 -0
  20. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/ADBKeyBoard.apk +0 -0
  21. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/abl.strings +0 -0
  22. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/awl.strings +0 -0
  23. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/max.config +0 -0
  24. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/max.fuzzing.strings +0 -0
  25. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/max.schema.strings +0 -0
  26. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/max.strings +0 -0
  27. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/max.tree.pruning +0 -0
  28. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_configs/widget.block.py +0 -0
  29. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_libs/arm64-v8a/libfastbot_native.so +0 -0
  30. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_libs/armeabi-v7a/libfastbot_native.so +0 -0
  31. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_libs/x86/libfastbot_native.so +0 -0
  32. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/fastbot_libs/x86_64/libfastbot_native.so +0 -0
  33. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/framework.jar +0 -0
  34. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/monkeyq.jar +0 -0
  35. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/assets/u2.jar +0 -0
  36. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/logWatcher.py +0 -0
  37. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/kea2/utils.py +0 -0
  38. {kea2_python-0.0.1a2 → kea2_python-0.0.1a4}/setup.cfg +0 -0
@@ -1,18 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Kea2-python
3
- Version: 0.0.1a2
3
+ Version: 0.0.1a4
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
- Requires-Python: >=3.9
6
+ Requires-Python: >=3.8
7
7
  Description-Content-Type: text/markdown
8
8
  License-File: LICENSE
9
- Requires-Dist: rtree>=1.4.0
9
+ Requires-Dist: rtree>=1.3.0
10
10
  Requires-Dist: uiautomator2>=3.2.9
11
11
  Dynamic: license-file
12
12
 
13
13
  # Introduction
14
14
 
15
- Kea2 is an easy-to-use Python library for supporting and customizing automated UI testing for mobile apps. The library is currently built on top of [Fastbot](https://github.com/bytedance/Fastbot_Android) and [uiautomator2](https://github.com/openatx/uiautomator2), and targeting [Android](https://en.wikipedia.org/wiki/Android_(operating_system)) apps.
15
+ Kea2 is an easy-to-use Python library for supporting, customizing and improving automated UI testing for mobile apps. The library is currently built on top of [Fastbot](https://github.com/bytedance/Fastbot_Android) and [uiautomator2](https://github.com/openatx/uiautomator2), and targeting [Android](https://en.wikipedia.org/wiki/Android_(operating_system)) apps.
16
16
 
17
17
  ### Kea2 has three important features:
18
18
  - **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*);
@@ -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) *scripteds* (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.
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** |
@@ -52,7 +52,7 @@ In the future, Kea2 will be extended to support
52
52
 
53
53
  Running requirements/environment:
54
54
  - support Windows, MacOS and Linux
55
- - python 3.9+
55
+ - python 3.8+
56
56
  - Android SDK installed
57
57
  - **VPN closed** (Features 2 and 3 required)
58
58
 
@@ -99,7 +99,7 @@ kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --
99
99
  ```
100
100
 
101
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.
102
- See more options by `python kea_launcher.py driver -h`
102
+ See more options by `kea2 run -h`
103
103
 
104
104
 
105
105
  ## Feature 2(自定义测试场景或事件序列): customizing testing scenarios by scripts
@@ -153,14 +153,13 @@ You can find the full example in script `quickstart.py` and run it by executing:
153
153
  python3 quickstart.py u2
154
154
  ```
155
155
 
156
+ In real use, you can use `kea2 run` to launch the customizing script.
157
+
156
158
  ```bash
157
159
  # 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
160
+ kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -p quickstart.py
159
161
  ```
160
162
 
161
-
162
-
163
-
164
163
  ## Feature 3(支持断言机制): Supporting auto-assertions by scripts.
165
164
 
166
165
  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. This idea is inspired by [property-based testing](https://en.wikipedia.org/wiki/Software_testing#Property_testing) inheritted from [Kea](https://github.com/ecnusse/Kea).
@@ -1,2 +1,2 @@
1
- rtree>=1.4.0
1
+ rtree>=1.3.0
2
2
  uiautomator2>=3.2.9
@@ -1,18 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Kea2-python
3
- Version: 0.0.1a2
3
+ Version: 0.0.1a4
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
- Requires-Python: >=3.9
6
+ Requires-Python: >=3.8
7
7
  Description-Content-Type: text/markdown
8
8
  License-File: LICENSE
9
- Requires-Dist: rtree>=1.4.0
9
+ Requires-Dist: rtree>=1.3.0
10
10
  Requires-Dist: uiautomator2>=3.2.9
11
11
  Dynamic: license-file
12
12
 
13
13
  # Introduction
14
14
 
15
- Kea2 is an easy-to-use Python library for supporting and customizing automated UI testing for mobile apps. The library is currently built on top of [Fastbot](https://github.com/bytedance/Fastbot_Android) and [uiautomator2](https://github.com/openatx/uiautomator2), and targeting [Android](https://en.wikipedia.org/wiki/Android_(operating_system)) apps.
15
+ Kea2 is an easy-to-use Python library for supporting, customizing and improving automated UI testing for mobile apps. The library is currently built on top of [Fastbot](https://github.com/bytedance/Fastbot_Android) and [uiautomator2](https://github.com/openatx/uiautomator2), and targeting [Android](https://en.wikipedia.org/wiki/Android_(operating_system)) apps.
16
16
 
17
17
  ### Kea2 has three important features:
18
18
  - **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*);
@@ -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) *scripteds* (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.
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** |
@@ -52,7 +52,7 @@ In the future, Kea2 will be extended to support
52
52
 
53
53
  Running requirements/environment:
54
54
  - support Windows, MacOS and Linux
55
- - python 3.9+
55
+ - python 3.8+
56
56
  - Android SDK installed
57
57
  - **VPN closed** (Features 2 and 3 required)
58
58
 
@@ -99,7 +99,7 @@ kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --
99
99
  ```
100
100
 
101
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.
102
- See more options by `python kea_launcher.py driver -h`
102
+ See more options by `kea2 run -h`
103
103
 
104
104
 
105
105
  ## Feature 2(自定义测试场景或事件序列): customizing testing scenarios by scripts
@@ -153,14 +153,13 @@ You can find the full example in script `quickstart.py` and run it by executing:
153
153
  python3 quickstart.py u2
154
154
  ```
155
155
 
156
+ In real use, you can use `kea2 run` to launch the customizing script.
157
+
156
158
  ```bash
157
159
  # 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
160
+ kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -p quickstart.py
159
161
  ```
160
162
 
161
-
162
-
163
-
164
163
  ## Feature 3(支持断言机制): Supporting auto-assertions by scripts.
165
164
 
166
165
  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. This idea is inspired by [property-based testing](https://en.wikipedia.org/wiki/Software_testing#Property_testing) inheritted from [Kea](https://github.com/ecnusse/Kea).
@@ -1,6 +1,6 @@
1
1
  # Introduction
2
2
 
3
- Kea2 is an easy-to-use Python library for supporting and customizing automated UI testing for mobile apps. The library is currently built on top of [Fastbot](https://github.com/bytedance/Fastbot_Android) and [uiautomator2](https://github.com/openatx/uiautomator2), and targeting [Android](https://en.wikipedia.org/wiki/Android_(operating_system)) apps.
3
+ Kea2 is an easy-to-use Python library for supporting, customizing and improving automated UI testing for mobile apps. The library is currently built on top of [Fastbot](https://github.com/bytedance/Fastbot_Android) and [uiautomator2](https://github.com/openatx/uiautomator2), and targeting [Android](https://en.wikipedia.org/wiki/Android_(operating_system)) apps.
4
4
 
5
5
  ### Kea2 has three important features:
6
6
  - **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*);
@@ -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) *scripteds* (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.
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** |
@@ -40,7 +40,7 @@ In the future, Kea2 will be extended to support
40
40
 
41
41
  Running requirements/environment:
42
42
  - support Windows, MacOS and Linux
43
- - python 3.9+
43
+ - python 3.8+
44
44
  - Android SDK installed
45
45
  - **VPN closed** (Features 2 and 3 required)
46
46
 
@@ -87,7 +87,7 @@ kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent native --
87
87
  ```
88
88
 
89
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.
90
- See more options by `python kea_launcher.py driver -h`
90
+ See more options by `kea2 run -h`
91
91
 
92
92
 
93
93
  ## Feature 2(自定义测试场景或事件序列): customizing testing scenarios by scripts
@@ -141,14 +141,13 @@ You can find the full example in script `quickstart.py` and run it by executing:
141
141
  python3 quickstart.py u2
142
142
  ```
143
143
 
144
+ In real use, you can use `kea2 run` to launch the customizing script.
145
+
144
146
  ```bash
145
147
  # 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
148
+ kea2 run -s "emulator-5554" -p it.feio.android.omninotes.alpha --agent u2 --running-minutes 10 --throttle 200 --driver-name d unittest discover -p quickstart.py
147
149
  ```
148
150
 
149
-
150
-
151
-
152
151
  ## Feature 3(支持断言机制): Supporting auto-assertions by scripts.
153
152
 
154
153
  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. This idea is inspired by [property-based testing](https://en.wikipedia.org/wiki/Software_testing#Property_testing) inheritted from [Kea](https://github.com/ecnusse/Kea).
@@ -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):
@@ -76,7 +76,9 @@ def check_installation():
76
76
  def _get_agent():
77
77
  import sys
78
78
  if len(sys.argv) == 0 or sys.argv[1] == "u2":
79
+ sys.argv=sys.argv[:1]
79
80
  return "u2"
81
+ sys.argv=sys.argv[:1]
80
82
  return "native"
81
83
 
82
84
  if __name__ == "__main__":
@@ -156,16 +156,14 @@ def main():
156
156
  kwargs.pop('args', None)
157
157
  sp.add_argument(*args, **kwargs)
158
158
 
159
- from .kea_launcher import _set_driver_parser
160
- _set_driver_parser(subparser)
159
+ from .kea_launcher import _set_runner_parser
160
+ _set_runner_parser(subparser)
161
161
  actions["run"] = cmd_run
162
162
  if sys.argv[1:] == ["run"]:
163
163
  sys.argv.append("-h")
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
@@ -93,6 +94,8 @@ class Options:
93
94
  running_mins: int = 10
94
95
  # time(ms) to wait when exploring the app
95
96
  throttle: int = 200
97
+ # the output_dir for saving logs and results
98
+ output_dir: str = "output"
96
99
 
97
100
 
98
101
  @dataclass
@@ -260,6 +263,13 @@ class KeaTestRunner(TextTestRunner):
260
263
  options.Driver = None
261
264
  cls.options = options
262
265
 
266
+ def _setOuputDir(self):
267
+ output_dir = Path(self.options.output_dir).absolute()
268
+ os.mkdir(output_dir, parents=True, exist_ok=True)
269
+ global LOGFILE, RESFILE
270
+ LOGFILE = output_dir / Path(LOGFILE)
271
+ RESFILE = output_dir / Path(RESFILE)
272
+
263
273
  def run(self, test):
264
274
 
265
275
  self.allProperties = dict()
@@ -268,6 +278,8 @@ class KeaTestRunner(TextTestRunner):
268
278
  if len(self.allProperties) == 0:
269
279
  print("[Warning] No property has been found.", flush=True)
270
280
 
281
+ self._setOuputDir()
282
+
271
283
  JsonResult.setProperties(self.allProperties)
272
284
  self.resultclass = JsonResult
273
285
 
@@ -442,7 +454,13 @@ class KeaTestRunner(TextTestRunner):
442
454
  # Dependency injection. Static driver checker for precond
443
455
  setattr(test, self.options.driverName, staticCheckerDriver)
444
456
  # excecute the precond
445
- if not precond(test):
457
+ try:
458
+ if not precond(test):
459
+ valid = False
460
+ break
461
+ except Exception as e:
462
+ print(f"[ERROR] Error when checking precond: {getFullPropName(test)}", flush=True)
463
+ traceback.print_exc()
446
464
  valid = False
447
465
  break
448
466
  # if all the precond passed. make it the candidate prop.
@@ -1,9 +1,11 @@
1
+ import os
1
2
  import sys
2
3
  import argparse
3
4
  import unittest
5
+ from pathlib import Path
4
6
  from typing import List
5
7
 
6
- def _set_driver_parser(subparsers: "argparse._SubParsersAction[argparse.ArgumentParser]"):
8
+ def _set_runner_parser(subparsers: "argparse._SubParsersAction[argparse.ArgumentParser]"):
7
9
  parser = subparsers.add_parser("run", help="run kea2")
8
10
  parser.add_argument(
9
11
  "-s",
@@ -23,6 +25,16 @@ def _set_driver_parser(subparsers: "argparse._SubParsersAction[argparse.Argument
23
25
  help="The target package names com.example.app",
24
26
  )
25
27
 
28
+ parser.add_argument(
29
+ "-o",
30
+ "--output-dir",
31
+ dest="output_dir",
32
+ type=str,
33
+ required=False,
34
+ default="output",
35
+ help="The output dir for saving logs and results."
36
+ )
37
+
26
38
  parser.add_argument(
27
39
  "--agent",
28
40
  dest="agent",
@@ -96,7 +108,7 @@ def parse_args(argv: List):
96
108
  parser = argparse.ArgumentParser(description="Kea2")
97
109
  subparsers = parser.add_subparsers(dest="command", required=True)
98
110
 
99
- _set_driver_parser(subparsers)
111
+ _set_runner_parser(subparsers)
100
112
  args = parser.parse_args(argv)
101
113
  return args
102
114
 
@@ -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": "true"})
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:
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "Kea2-python"
3
- version = "0.0.1a2"
3
+ version = "0.0.1a4"
4
4
  description = "A python library for supporting and customizing automated UI testing for mobile apps"
5
5
  readme = "README.md"
6
- requires-python = ">=3.9"
6
+ requires-python = ">=3.8"
7
7
  dependencies = [
8
- "rtree>=1.4.0",
8
+ "rtree>=1.3.0",
9
9
  "uiautomator2>=3.2.9",
10
10
  ]
11
11
  authors = [
File without changes
File without changes