Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
XixianLiang committed Aug 23, 2024
1 parent d040d4d commit 08e0ecf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 26 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[中文文档](https://github.com/XixianLiang/HMDroidbot/blob/master/README_cn.md)
### :book: [中文文档](https://github.com/XixianLiang/HMDroidbot/blob/master/README_cn.md)


## :memo: About
HMDroidbot (HM stands for HarmonyOS, Droid stands for Android) is a lightweight test input generator for HarmonyOS (and Android). It forks from [Droidbot](https://github.com/honeynet/droidbot) and supports HarmonyOS NEXT devices.
Expand Down Expand Up @@ -36,9 +37,9 @@ It can send random or scripted input events to test an HarmonyOS app, achieve hi

Clone this repo and install with `pip`.

- (Optional) You can setup a virtual envirnment before installation.
:one: *(Optional)* You can setup a virtual envirnment before installation. See [venv module](https://realpython.com/python-virtual-environments-a-primer/) for details.

In Unix:
In macOS or Linux:
```shell
python3 -m venv droidenv
source droidenv/bin/activate
Expand All @@ -50,15 +51,15 @@ It can send random or scripted input events to test an HarmonyOS app, achieve hi
.\droidenv\Scripts\activate
```

- The following `pip` command will automatic grep and install the required packages for you.
:two: The following `pip` command will automatic grep and install the required packages for you.

```shell
git clone git@github.com:XixianLiang/HMDroidbot.git
cd HMdroidbot
git clone https://github.com/XixianLiang/HMDroidbot.git
cd HMDroidbot
pip install -e .
```

If successfully installed, you should be able to execute `droidbot -h`. (If failed to run `droidbot` cmd, try to use `python3 -m droidbot.start -h` instead).
:three: If successfully installed, you should be able to execute `droidbot -h`. (If failed to run `droidbot` cmd, try to use `python3 -m droidbot.start -h` instead).

2. **Quick Start (Only available in WSL now):**

Expand All @@ -69,12 +70,12 @@ It can send random or scripted input events to test an HarmonyOS app, achieve hi

2. **Start HMDroidbot:**

:+1: Run droidbot by `python -m`.
Run droidbot by `python -m`.
```bash
python3 -m droidbot.start -a <absolute_path_to_hap> -o output_dir -is_harmonyos
```

:-1: Run droidbot by `droidbot`
Run droidbot by `droidbot`
```bash
droidbot -a <absolute_path_to_hap> -o output_dir -is_harmonyos
```
Expand All @@ -99,7 +100,8 @@ It can send random or scripted input events to test an HarmonyOS app, achieve hi
python -m droidbot.start -a <absolute_path_to_hap> -o output -t 23E**********1843 -count 1000 -is_harmonyos -debug
```

**vscode Debug file example**
**vscode `launch.json` example**

<img width="1134" alt="image" src="https://github.com/user-attachments/assets/bffde3f3-deea-41fb-9087-fb7eb3772bd5">


Expand All @@ -117,6 +119,10 @@ Currently, HMDroidbot is maintained by [华东师范大学-移动软件分析与

This project is led by [Xixian Liang](https://xixianliang.github.io/resume/) and [Mengli Ming](https://ml-ming.dev/). We are supervised by Prof. [Ting Su](https://tingsu.github.io/). Feel free to contact us if you have any questions or advices.

Join the QQ group (ID 904153331) to contact us and get the latest info.

<img width="284" alt="image" src="https://github.com/user-attachments/assets/c42c2bdf-6c3d-4774-a2a4-34adcc84cfe7">

## Acknowledgement

- [Droidbot](https://github.com/honeynet/droidbot)
Expand Down
37 changes: 21 additions & 16 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,39 @@ HMDroidbot(HM代表HarmonyOS,Droid代表Android)是一个轻量级的测

+ 要分析的应用程序的 `.hap` 文件路径。

我们提供了一些用于测试的示例hap [在这里](https://github.com/XixianLiang/HarmonyOS_NEXT_apps)
我们提供了一些[用于测试的示例hap](https://github.com/XixianLiang/HarmonyOS_NEXT_apps)

+ 一台通过 `hdc` 连接到主机的设备或模拟器。使用 `hdc list targets` 检查连接的设备。

+ 根据系统正确选择 `SYSTEM` 变量。请参见下文 **故障排除** 章节。

+ 安装所需的包。

克隆此仓库并使用 `pip` 安装。
clone 此仓库并使用 `pip` 安装。

- (可选) 你可以先设置一个虚拟环境,详情请见python的venv模块
:one: *(可选)* 你可以先设置一个虚拟环境,详情请见 python 的 [venv 模块](https://realpython.com/python-virtual-environments-a-primer/)

Unix系统:
**macOS 或 Linux 系统:**
```shell
python3 -m venv droidenv
source droidenv/bin/activate
```

Windows系统:
**Windows系统:**
```powershell
python3 -m venv droidenv
.\droidenv\Scripts\activate
```

- 下面的 `pip` 命令将自动抓取并安装所需的包。
:two: 下面的 `pip` 命令将自动抓取并安装所需的包。

```shell
git clone git@github.com:XixianLiang/HMDroidbot.git
cd HMdroidbot
git clone https://github.com/XixianLiang/HMDroidbot.git
cd HMDroidbot
pip install -e .
```

如果安装成功,您应该能够执行 `droidbot -h`。(如果无法运行 `droidbot` 命令,请尝试使用 `python3 -m droidbot.start -h` 代替)。
:three: 如果安装成功,您应该能够执行 `droidbot -h`。(如果无法运行 `droidbot` 命令,请尝试使用 `python3 -m droidbot.start -h` 代替)。

2. **快速开始(目前仅在WSL中可用):**

Expand All @@ -65,14 +65,14 @@ HMDroidbot(HM代表HarmonyOS,Droid代表Android)是一个轻量级的测
bash run_sample.sh
```

2. **启动HMDroidbot:**
3. **启动HMDroidbot:**

:+1: 通过 `python -m` 运行droidbot。
通过 `python -m` 运行droidbot。
```bash
python3 -m droidbot.start -a <hap的绝对路径> -o output_dir -is_harmonyos
```

:-1: 通过 `droidbot` 运行droidbot。
通过 `droidbot` 运行droidbot。
```bash
droidbot -a <hap的绝对路径> -o output_dir -is_harmonyos
```
Expand All @@ -81,8 +81,8 @@ HMDroidbot(HM代表HarmonyOS,Droid代表Android)是一个轻量级的测
测试开始后,您将在输出目录中实时找到许多有用的信息,包括生成的UTG。

+ 如果您使用多个设备,您可能需要使用 `-t <device_serial>` 来指定目标设备。确定设备序列号的最简单方法是调用 `hdc list targets`
+ 在调试源代码时,您可能会发现 `-debug` 标志很有用
+ 使用 `-log` 标志获取HarmonyOS中的hilog,可以在报告目录中找到
+ 在调试源代码时, `-debug` 很有用
+ 使用 `-log` 标志获取HarmonyOS中的hilog,可以在报告目录中找到这个文件
+ 您可以在 `droidbot -h` 中找到其他有用的功能。

**示例启动脚本**
Expand All @@ -91,11 +91,12 @@ HMDroidbot(HM代表HarmonyOS,Droid代表Android)是一个轻量级的测
droidbot -a <hap的绝对路径> -o output -t 23E**********1843 -count 1000 -is_harmonyos -debug
# 通过运行模块启动。易于调试!
# 在HMDroidbot目录中执行以下命令,该目录应包含setup.py
# 在HMDroidbot目录中执行以下命令。
python -m droidbot.start -a <hap的绝对路径> -o output -t 23E**********1843 -count 1000 -is_harmonyos -debug
```

**vscode调试文件示例**
**vscode `launch.json` 文件示例**

<img width="1134" alt="image" src="https://github.com/user-attachments/assets/bffde3f3-deea-41fb-9087-fb7eb3772bd5">


Expand All @@ -113,6 +114,10 @@ HMDroidbot(HM代表HarmonyOS,Droid代表Android)是一个轻量级的测

该项目的主要负责人是[梁锡贤](https://xixianliang.github.io/resume/)和[明孟立](https://ml-ming.dev/)。我们的指导老师是[苏亭教授](https://tingsu.github.io/)。如果您有任何问题或建议,请随时与我们联系。

加入QQ交流群 (群号 904153331)来联系我们并获取最新资讯。

<img width="284" alt="image" src="https://github.com/user-attachments/assets/c42c2bdf-6c3d-4774-a2a4-34adcc84cfe7">

## 致谢

- [Droidbot](https://github.com/honeynet/droidbot)
Expand Down

0 comments on commit 08e0ecf

Please sign in to comment.