Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliuxin committed Feb 14, 2019
1 parent 5a39401 commit 010ad4b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 70 deletions.
65 changes: 31 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ Android |[Emulator](./docs/wiki/platforms.md#android-emulator) |[iOS](https://gi
Use `pip` to install Airtest python library.

```Shell
pip install -U airtest
pip install -U airtest
```

On MacOS/Linux platform, you need to grant adb execute permission.

```Shell
# for mac
cd {your_python_path}/site-packages/airtest/core/android/static/adb/mac
# for linux
# cd {your_python_path}/site-packages/airtest/core/android/static/adb/linux
chmod +x adb
# for mac
cd {your_python_path}/site-packages/airtest/core/android/static/adb/mac
# for linux
# cd {your_python_path}/site-packages/airtest/core/android/static/adb/linux
chmod +x adb
```

Download AirtestIDE from our [homepage](http://airtest.netease.com/) if you need to use the GUI tool.
Expand All @@ -57,28 +57,25 @@ You can find the complete Airtest documentation on [readthedocs](http://airtest.
Airtest aims at providing platform independent API, so that you can write automated cases once and run it on multiple devices and platforms.

1. Using [connect_device](http://airtest.readthedocs.io/en/latest/README_MORE.html#connect-device) API you can connect to any android/iOS device or windows application.

2. Then perform [simulated input](http://airtest.readthedocs.io/en/latest/README_MORE.html#simulate-input) to automate your game or app.

3. **DO NOT** forget to [make assertions](http://airtest.readthedocs.io/en/latest/README_MORE.html#make-assertion) of the expected result.
1. Then perform [simulated input](http://airtest.readthedocs.io/en/latest/README_MORE.html#simulate-input) to automate your game or app.
1. **DO NOT** forget to [make assertions](http://airtest.readthedocs.io/en/latest/README_MORE.html#make-assertion) of the expected result.

```Python

from airtest.core.api import *

# connect an android phone with adb
init_device("Android")
# or use connect_device api
# connect_device("Android:///")

install("path/to/your/apk")
start_app("package_name_of_your_apk")
touch(Template("image_of_a_button.png"))
swipe(Template("slide_start.png"), Template("slide_end.png"))
assert_exists(Template("success.png"))
keyevent("BACK")
home()
uninstall("package_name_of_your_apk")
from airtest.core.api import *

# connect an android phone with adb
init_device("Android")
# or use connect_device api
# connect_device("Android:///")

install("path/to/your/apk")
start_app("package_name_of_your_apk")
touch(Template("image_of_a_button.png"))
swipe(Template("slide_start.png"), Template("slide_end.png"))
assert_exists(Template("success.png"))
keyevent("BACK")
home()
uninstall("package_name_of_your_apk")
```

For more detailed info, please refer to [Airtest Python API reference](http://airtest.readthedocs.io/en/latest/all_module/airtest.core.api.html) or take a look at [API code](./airtest/core/api.py)
Expand All @@ -90,17 +87,17 @@ Using AirtestIDE, you can easily create automated cases as ``.air`` directories.
Airtest CLI provides the possibility to execute cases on different host machine and target device platforms without using AirtestIDE itself.

```Shell
# run cases targeting on Android phone connected to your host machine via ADB
airtest run "path to your .air dir" --device Android:///
# run cases targeting on Android phone connected to your host machine via ADB
airtest run "path to your .air dir" --device Android:///

# run cases targeting on Windows application whose title matches Unity.*
airtest run "path to your .air dir" --device "Windows:///?title_re=Unity.*"
# run cases targeting on Windows application whose title matches Unity.*
airtest run "path to your .air dir" --device "Windows:///?title_re=Unity.*"

# generate HTML report after running cases
airtest report "path to your .air dir"
# generate HTML report after running cases
airtest report "path to your .air dir"

# or use as python module
python -m airtest run "path to your .air dir" --device Android:///
# or use as python module
python -m airtest run "path to your .air dir" --device Android:///
```

Try running provided example case: [``airtest/playground/test_blackjack.air``](./playground/test_blackjack.air) and see [Usage of CLI](http://airtest.readthedocs.io/en/latest/README_MORE.html#running-air-from-cli).
Expand Down
70 changes: 34 additions & 36 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

## 快速开始

* **跨平台:**Airtest支持几乎所有平台的UI自动化,适用于游戏和App。

* **各种运行:**Airtest提供了跨平台的API,包括安装应用、模拟输入、断言等。 基于图像识别技术定位UI元素,你无需嵌入任何代码即可进行自动化。

* **扩展性:**Airtest提供了命令行和python接口,可以很容易地在大规模设备集群上运行。自动生成的HTML报告,包含详细步骤和录屏,让你迅速定位失败点。

* **AirtestIDE:** 是一个强大的GUI工具,可以帮助你录制和调试自动化脚本。 AirtestIDE支持了完整的自动化流程:``录制脚本->真机回放->生成报告``

* **Poco:** [Poco](https://github.com/AirtestProject/Poco) 框架可以直接访问UI控件,支持主流平台和游戏引擎。通过Python API操作UI控件,可以实现更强大的自动化控制。

[从官网开始上手吧](http://airtest.netease.com/)


Expand All @@ -30,17 +30,17 @@ Android|[iOS](https://github.com/AirtestProject/iOS-Tagent)|Windows|Unity|Cocos2
使用 `pip` 安装Airtest框架

```Shell
pip install -U airtest
pip install -U airtest
```

在Mac/Linux系统下,需要手动赋予adb可执行权限

```Shell
# mac系统
cd {your_python_path}/site-packages/airtest/core/android/static/adb/mac
# linux系统
# cd {your_python_path}/site-packages/airtest/core/android/static/adb/linux
chmod +x adb
# mac系统
cd {your_python_path}/site-packages/airtest/core/android/static/adb/mac
# linux系统
# cd {your_python_path}/site-packages/airtest/core/android/static/adb/linux
chmod +x adb
```

如果你需要使用GUI工具,请从 [官网](http://airtest.netease.com/) 下载AirtestIDE。
Expand All @@ -56,28 +56,26 @@ Android|[iOS](https://github.com/AirtestProject/iOS-Tagent)|Windows|Unity|Cocos2
Airtest希望提供平台无关的API,让你的自动化代码可以运行在不同平台的应用上。

1. 使用 [connect_device](http://airtest.readthedocs.io/zh_CN/latest/README_MORE.html#connect-device) 来连接任意Android设备或者Windows窗口。

2. 使用 [模拟操作](http://airtest.readthedocs.io/zh_CN/latest/README_MORE.html#simulate-input) 的API来自动化你的游戏或者App。

3. **不要** 忘记 [声明断言](http://airtest.readthedocs.io/zh_CN/latest/README_MORE.html#make-assertion) 来验证结果。
1. 使用 [模拟操作](http://airtest.readthedocs.io/zh_CN/latest/README_MORE.html#simulate-input) 的API来自动化你的游戏或者App。
1. **不要** 忘记 [声明断言](http://airtest.readthedocs.io/zh_CN/latest/README_MORE.html#make-assertion) 来验证结果。


```Python
from airtest.core.api import *

# 通过ADB连接本地Android设备
init_device("Android")
# 或者使用connect_device函数
# connect_device("Android:///")
connect_device("Android:///")
install("path/to/your/apk")
start_app("package_name_of_your_apk")
touch(Template("image_of_a_button.png"))
swipe(Template("slide_start.png"), Template("slide_end.png"))
assert_exists(Template("success.png"))
keyevent("BACK")
home()
uninstall("package_name_of_your_apk")
from airtest.core.api import *

# 通过ADB连接本地Android设备
init_device("Android")
# 或者使用connect_device函数
# connect_device("Android:///")
connect_device("Android:///")
install("path/to/your/apk")
start_app("package_name_of_your_apk")
touch(Template("image_of_a_button.png"))
swipe(Template("slide_start.png"), Template("slide_end.png"))
assert_exists(Template("success.png"))
keyevent("BACK")
home()
uninstall("package_name_of_your_apk")
```

更详细的说明请看 [Airtest Python API 文档](http://airtest.readthedocs.io/zh_CN/latest/all_module/airtest.core.api.html) 或者直接看 [API代码](./airtest/core/api.py)
Expand All @@ -89,25 +87,25 @@ Airtest希望提供平台无关的API,让你的自动化代码可以运行在
Airtest命令行则让你能够脱离IDE,在不同宿主机器和被测设备上运行自动化脚本。

```Shell
# 在本地ADB连接的安卓手机上运行脚本
airtest run "path to your air dir" --device Android:///
# 在本地ADB连接的安卓手机上运行脚本
airtest run "path to your air dir" --device Android:///

# 在Windows应用上运行脚本
airtest run "path to your air dir" --device "Windows:///?title_re=Unity.*"
# 在Windows应用上运行脚本
airtest run "path to your air dir" --device "Windows:///?title_re=Unity.*"

# 生成HTML报告
airtest report "path to your air dir"
# 生成HTML报告
airtest report "path to your air dir"

# 也可以用python -m的方式使用命令行
python -m airtest run "path to your air dir" --device Android:///
# 也可以用python -m的方式使用命令行
python -m airtest run "path to your air dir" --device Android:///
```

试试样例[airtest/playground/test_blackjack.air](./playground/test_blackjack.air),更多用法看[命令行用法](http://airtest.readthedocs.io/zh_CN/latest/README_MORE.html#running-air-from-cli)


## 贡献代码

欢迎大家fork和提pull requests。
欢迎大家fork和提pull requests。[这里需要大家的帮助](./docs/wiki/platforms.md#pull-request-guide)


## 致谢
Expand Down

0 comments on commit 010ad4b

Please sign in to comment.